1+ name : Fetch Repo Traffic Stats
2+
13on :
24 schedule :
5+ # Runs every 14 days at midnight UTC.
36 - cron : " 0 0 */14 * *"
4- workflow_dispatch :
7+ workflow_dispatch : # Allows manual runs
58
69jobs :
7- # This workflow contains a single job called "traffic"
810 traffic :
9- # The type of runner that the job will run on
1011 runs-on : ubuntu-latest
12+
13+ # --- ADD THIS BLOCK ---
14+ # This grants the GITHUB_TOKEN the necessary permissions.
1115 permissions :
12- # Give the default GITHUB_TOKEN write permission to commit and push the
13- # added or changed files to the repository.
1416 contents : write
1517
1618 steps :
1719 - name : Checkout current repo
18- uses : actions/checkout@v4.1.1
19-
20+ uses : actions/checkout@v4
21+
2022 - name : Setup Python
21- uses : actions/setup-python@v5.0.0
23+ uses : actions/setup-python@v5
2224 with :
2325 python-version : ' 3.10'
2426
25- - name : install depedencies
27+ - name : Install dependencies
2628 run : pip install requests
2729
2830 - name : Run Python script to generate summary
2931 run : python3 github_stats.py
3032 env :
31- GITHUB_TOKEN : ${{secrets.GHRS_GITHUB_API_TOKEN }}
33+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3234 GITHUB_REPOSITORY : ${{ github.repository }}
3335
34- - name : view summary file
35- run : cat traffic/summary.csv
36-
37- - name : list generated files
38- run : ls -ltrh
39-
4036 - name : Commit and push changes
4137 uses : stefanzweifel/git-auto-commit-action@v5
4238 with :
43- commit_message : " Update CSV with new data from github action"
39+ commit_message : " chore: Update repository traffic stats"
40+ # Ensure this matches the output directory in your Python script
41+ file_pattern : traffic/*
0 commit comments