name: CI on: pull_request: push: branches: [main] permissions: contents: read jobs: validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v2 - name: Validate contribution data run: bun scripts/validate-data.ts sync-registry: # The README Registry tables are generated from models/*.json. Contributors # do not edit them by hand; on every push to main we regenerate and commit # any drift back. Commits pushed with GITHUB_TOKEN do not retrigger # workflows, and the message carries [skip ci] too, so there is no loop. if: github.event_name == 'push' needs: validate runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v2 - name: Regenerate README registry run: bun scripts/update-registry.ts - name: Commit if registry drifted run: | if git diff --quiet -- README.md README.en.md; then echo "Registry already in sync." exit 0 fi git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git commit -am "chore: sync README registry [skip ci]" git push origin HEAD:main trigger-site-rebuild: # The site lives in the private nagi-bench-site repo (Cloudflare Pages). # With SITE_DISPATCH_TOKEN set the rebuild is instant; without it the # site's 6-hour cron picks the new data up anyway. if: github.event_name == 'push' needs: validate runs-on: ubuntu-latest steps: - name: Dispatch data-updated to nagi-bench-site env: TOKEN: ${{ secrets.SITE_DISPATCH_TOKEN }} run: | if [ -z "$TOKEN" ]; then echo "SITE_DISPATCH_TOKEN not set; relying on the site's scheduled rebuild." exit 0 fi curl -sf -X POST \ -H "Authorization: Bearer $TOKEN" \ -H "Accept: application/vnd.github+json" \ https://api.github.com/repos/nagi-studio/nagi-bench-site/dispatches \ -d '{"event_type":"data-updated"}'