Update Org Profile Stats #227
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 Org Profile Stats | |
| on: | |
| workflow_dispatch: {} | |
| schedule: | |
| - cron: "17 3 * * *" # daily at 03:17 UTC — adjust as you like | |
| push: | |
| paths: | |
| - "scripts/**" | |
| - "package.json" | |
| - "profile/README.md" | |
| - ".github/workflows/org-stats.yml" | |
| jobs: | |
| update-org-stats: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # to push README changes | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install (no deps needed) | |
| run: npm ci --ignore-scripts --prefer-offline || true | |
| - name: Update stats in README | |
| env: | |
| ORG: kir-rescomp | |
| # Prefer a PAT if including PRIVATE repos; else GITHUB_TOKEN is fine for public. | |
| GH_TOKEN: ${{ secrets.ORG_TOKEN || secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npm run update | |
| - name: Commit & push if changed | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add profile/README.md | |
| git commit -m "chore: update org stats [skip ci]" | |
| git push | |
| else | |
| echo "No changes to commit." | |
| fi |