Update FOOPS Score Badge #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update FOOPS Score Badge | |
on: | |
workflow_run: | |
workflows: ["docs"] | |
types: | |
- completed | |
env: | |
GIT_USER_NAME: BattINFO Developers | |
GIT_USER_EMAIL: "[email protected]" | |
jobs: | |
update-badge: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: pip install requests | |
- name: Fetch FOOPS score and update badge | |
run: | | |
python docs/scripts/generate_foops_badge.py | |
- name: Configure Git | |
run: | | |
git config --local user.email "${{ env.GIT_USER_EMAIL }}" | |
git config --local user.name "${{ env.GIT_USER_NAME }}" | |
- name: Commit any changes before pulling | |
run: | | |
git add -A | |
git diff --staged --quiet || git commit -m "Stash changes before pull" | |
- name: Pull latest changes | |
run: git pull origin master --rebase | |
- name: Commit changes | |
run: | | |
git add README.md | |
git diff --staged --quiet || git commit -m "Update FOOPS score badge" | |
- name: Push changes | |
run: git push origin HEAD:master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |