Skip to content

Commit c2898e6

Browse files
committed
feat(ci): pass HF_TOKEN to weekly stats and add issues:write permission
- HF_TOKEN enables fetching download counts for gated HuggingFace repos - GITHUB_REPOSITORY lets update_stats.py open an issue when broken URLs are detected - issues:write and pull-requests:write added to workflow permissions
1 parent 4bfdce9 commit c2898e6

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

.github/workflows/weekly-update.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88

99
permissions:
1010
contents: write
11+
pull-requests: write
12+
issues: write
1113

1214
jobs:
1315
update:
@@ -28,19 +30,30 @@ jobs:
2830
- name: Fetch latest stats (GitHub + HuggingFace)
2931
env:
3032
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
34+
GITHUB_REPOSITORY: ${{ github.repository }}
3135
run: python scripts/update_stats.py
3236

3337
- name: Regenerate README and dashboard data
3438
run: python scripts/generate_site.py
3539

36-
- name: Commit and push changes
40+
- name: Commit and open PR
41+
env:
42+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3743
run: |
3844
git config user.name "github-actions[bot]"
3945
git config user.email "github-actions[bot]@users.noreply.github.com"
4046
git add data/models.yaml data/datasets.yaml data/tools.yaml docs/data.json README.md
4147
if git diff --staged --quiet; then
4248
echo "No changes to commit."
43-
else
44-
git commit -m "chore: weekly stats update $(date +'%Y-%m-%d')"
45-
git push
49+
exit 0
4650
fi
51+
BRANCH="chore/weekly-stats-$(date +'%Y-%m-%d')"
52+
git checkout -b "$BRANCH"
53+
git commit -m "chore: weekly stats update $(date +'%Y-%m-%d')"
54+
git push origin "$BRANCH"
55+
gh pr create \
56+
--title "chore: weekly stats update $(date +'%Y-%m-%d')" \
57+
--body "Automated weekly GitHub stars / HuggingFace downloads update." \
58+
--head "$BRANCH" \
59+
--base main

0 commit comments

Comments
 (0)