Repository navigation
59 lines (51 loc) · 1.7 KB
/
Copy pathcards.yml
File metadata and controls
59 lines (51 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: generate stat cards
# Everything the README shows is rendered here and committed into the repo.
# No third-party card service, so nothing on the profile can 404 when someone
# else's free Vercel deployment goes away.
on:
schedule:
- cron: "17 2 * * *" # daily, offset off the hour to dodge the cron rush
workflow_dispatch:
push:
branches: [main]
paths:
- "scripts/**"
- ".github/workflows/cards.yml"
permissions:
contents: write
# Never let two runs race each other onto main.
concurrency:
group: stat-cards
cancel-in-progress: false
jobs:
render:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Render cards
env:
# Lifts the GitHub API budget from 60/hour to 1000/hour, which is what
# makes the per-repository language pass possible.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node scripts/generate-cards.mjs
- name: Commit any changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add assets
if git diff --cached --quiet; then
echo "cards unchanged"
exit 0
fi
git commit -m "chore: refresh stat cards [skip ci]"
# The snake workflow also pushes to main; rebase rather than fight it.
for attempt in 1 2 3; do
git pull --rebase --autostash origin main && git push && exit 0
echo "push attempt $attempt failed, retrying"
sleep 5
done
exit 1