Files
awesome-coding-agents/.github/workflows/update.yml
T

57 lines
1.4 KiB
YAML

name: Update rankings
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
push:
branches: [main]
paths:
- 'data/agents.yml'
- 'templates/**'
- '**.go'
- 'go.mod'
- '.github/workflows/update.yml'
permissions:
contents: write
concurrency:
group: update-rankings
cancel-in-progress: false
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
cache: true
- name: Run updater
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: go run .
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md data/history.jsonl
if git diff --staged --quiet; then
echo "no changes"
exit 0
fi
git commit -m "chore: daily ranking refresh"
# rebase + retry guards against the race where two runs commit near-simultaneously.
# -X theirs makes our run's data/history.jsonl line win conflicts (our snapshot is the freshest).
for attempt in 1 2 3; do
if git push; then exit 0; fi
echo "push attempt $attempt rejected, rebasing on origin/main"
git pull --rebase -X theirs origin main
done
exit 1