Scheduled rescore #469
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: Scheduled rescore | |
| on: | |
| schedule: | |
| - cron: "0 */6 * * *" | |
| workflow_dispatch: | |
| concurrency: | |
| group: scheduled-rescore | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| rescore: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.2.16 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install | |
| run: bun install --frozen-lockfile | |
| # badge_embedded is here despite not being a score: adoption leaves every | |
| # overall_score identical, so a scores-only diff reads the run as a no-op | |
| # and discards the flag with the runner, every run, forever. | |
| - name: Snapshot pre-rescore state | |
| run: sqlite3 data/rank.db "SELECT url, overall_score, badge_embedded FROM repo ORDER BY url;" > /tmp/state-before.txt | |
| - name: Rescore curated seeds | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: bun run seed | |
| - name: Commit and push if any score or badge adoption changed | |
| run: | | |
| sqlite3 data/rank.db "SELECT url, overall_score, badge_embedded FROM repo ORDER BY url;" > /tmp/state-after.txt | |
| if diff -q /tmp/state-before.txt /tmp/state-after.txt > /dev/null; then | |
| echo "No score or badge-adoption changes — skipping commit (last_scored_at churn ignored)." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add data/rank.db | |
| git commit -m "chore: scheduled rescore $(date -u +%Y-%m-%dT%H:%MZ)" | |
| git push |