-
Notifications
You must be signed in to change notification settings - Fork 3
41 lines (33 loc) · 1.06 KB
/
main.yml
File metadata and controls
41 lines (33 loc) · 1.06 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
name: Fetch Repo Traffic Stats
on:
schedule:
# Runs every Monday at midnight UTC
- cron: "0 0 * * 1"
workflow_dispatch: # Allows manual runs
jobs:
traffic:
runs-on: ubuntu-latest
# --- ADD THIS BLOCK ---
# This grants the GITHUB_TOKEN the necessary permissions.
permissions:
contents: write
steps:
- name: Checkout current repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: pip install requests
- name: Run Python script to generate summary
run: python3 github_stats.py
env:
GITHUB_TOKEN: ${{ secrets.GHRS_GITHUB_API_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: Update repository traffic stats"
# Ensure this matches the output directory in your Python script
file_pattern: traffic/*