File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Update clone stats
2+
3+ on :
4+ schedule :
5+ - cron : " 0 */12 * * *"
6+ workflow_dispatch :
7+
8+ jobs :
9+ update-clones :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout repo
13+ uses : actions/checkout@v4
14+
15+ - name : Get clone stats
16+ run : |
17+ OWNER=${GITHUB_REPOSITORY%/*}
18+ REPO=${GITHUB_REPOSITORY#*/}
19+ curl -s \
20+ -H "Accept: application/vnd.github+json" \
21+ -H "Authorization: Bearer ${{ secrets.CLONE_STATS_TOKEN }}" \
22+ https://api.github.com/repos/$OWNER/$REPO/traffic/clones \
23+ > clones.json
24+
25+ - name : Commit changes
26+ run : |
27+ if git diff --quiet; then
28+ echo "No changes."
29+ exit 0
30+ fi
31+ git config user.name "github-actions[bot]"
32+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
33+ git add clones.json
34+ git commit -m "Update clone stats"
35+ git push
You can’t perform that action at this time.
0 commit comments