-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (40 loc) · 1.17 KB
/
stats-tracker.yml
File metadata and controls
46 lines (40 loc) · 1.17 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
name: Repository Statistics Tracker
on:
schedule:
# Run every 6 hours
- cron: '0 */6 * * *'
workflow_dispatch: # Allow manual trigger
push:
branches: [ main ]
jobs:
track-stats:
runs-on: ubuntu-latest
permissions:
contents: write
metadata: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for git stats
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run stats tracker
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 realtime_stats_tracker.py
- name: Commit and push stats
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action Stats Bot"
git add REALTIME_STATS.json STATS_HISTORY.json REALTIME_STATS.md
# Only commit if there are changes
if ! git diff --staged --quiet; then
git commit -m "📊 Auto-update repository statistics [skip ci]"
git push
else
echo "No changes to commit"
fi