Created root downloads shield update scripts #1
This file contains hidden or 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 Downloads shield in root README | ||
| on: | ||
| schedule: | ||
| - cron: "45 35 * * 5" # every Fri @ 5:45 AM | ||
| workflow_dispatch: | ||
| jobs: | ||
| update-root-downloads-shield: | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| TZ: PST8PDT | ||
| steps: | ||
| - name: Checkout python-utils | ||
| uses: actions/checkout@v6.0.2 | ||
| with: | ||
| token: ${{ secrets.REPO_SYNC_PAT }} | ||
| - name: Set up Python | ||
| uses: actions/setup-python@6.2.0 | ||
| with: | ||
| python-version: '3.14' | ||
| - name: Update README shield | ||
| id: update_shields | ||
| run: | | ||
| # Run the Python script to update the shield | ||
| python3 utils/update_root_downloads_shield.py | ||
| # Check if the README file was modified | ||
| # We will compare the current file with the original to see if a change has happened | ||
| git diff --exit-code docs/README.md || echo "SHIELDS_UPDATED=true" >> $GITHUB_ENV | ||
| - name: Commit changes (if updated) | ||
| if: env.SHIELDS_UPDATED == 'true' | ||
| run: | | ||
| cd ${{ github.workspace }} | ||
| git add docs/README.md | ||
| # Generate a commit message | ||
| commit_msg="Updated Downloads shield in README" | ||
| echo "COMMIT_MSG=$commit_msg" >> $GITHUB_ENV | ||
| git commit -m "$COMMIT_MSG" | ||
| git push | ||
| - name: Set commit timestamp timezone (for matching timestamp with PST) | ||
| if: env.SHIELDS_UPDATED == 'true' | ||
| run: | | ||
| git config --global user.name "kudo-sync-bot" | ||
| git config --global user.email "auto-sync@kudoai.com" | ||
| git config --global user.signingkey "$GPG_PRIVATE_ID" | ||
| git config --global commit.gpgsign true | ||
| gpg --batch --import <(echo "$GPG_PRIVATE_KEY") | ||