Update statistics #358
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 statistics | |
on: | |
workflow_run: | |
workflows: ["Update blocklist"] | |
types: | |
- completed | |
jobs: | |
update-statistics: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tqdm | |
- name: Run script and update README | |
id: run-script | |
run: | | |
python analyze.py | |
- name: Commit changes | |
id: commit | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git diff --quiet && git diff --staged --quiet || (git commit -am "Update README statistics badges" && echo 'Changes were committed') || echo 'No changes to commit' | |
- name: Push changes | |
if: steps.commit.outcome == 'success' | |
run: git push origin HEAD:main |