MainQuest card #9
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: MainQuest card | |
| on: | |
| schedule: | |
| # Odd minute on purpose: :00 is heavily contended and runs get delayed. | |
| - cron: '37 4 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| # Never let two runs commit to the same branch at once. | |
| concurrency: | |
| group: mainquest | |
| cancel-in-progress: false | |
| jobs: | |
| card: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Codestz/mainquest@v1 | |
| with: | |
| # No github_token. It defaults to this workflow's own GITHUB_TOKEN, | |
| # which reads every public contribution. The only thing it cannot | |
| # read is restrictedContributionsCount — and this account has no | |
| # private work, so there is nothing for a PAT to add. Running the | |
| # same path a first-time user gets also means this repo notices if | |
| # that path ever breaks. | |
| username: Codestz | |
| outputs: public/stats | |
| cards: status,abilities | |
| - name: Commit the card | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add public/stats/card-*.svg public/stats/abilities-*.svg public/stats/mainquest.state.json | |
| # Commit even when nothing changed. | |
| # | |
| # Rendering is deterministic, so an unchanged profile produces | |
| # byte-identical SVGs and `git commit` would be a no-op. That is a | |
| # trap here: GitHub disables scheduled workflows after 60 days | |
| # without repository activity, and a card that never commits | |
| # eventually stops updating itself. An empty commit once a week is | |
| # cheap insurance; the rest of the time we skip. | |
| if git diff --cached --quiet; then | |
| if [ "$(date +%u)" = "1" ]; then | |
| git commit --allow-empty -m "chore: mainquest heartbeat (keeps the schedule alive)" | |
| git push | |
| else | |
| echo "No change; not Monday. Skipping." | |
| fi | |
| else | |
| git commit -m "chore: update mainquest card" | |
| git push | |
| fi |