-
Notifications
You must be signed in to change notification settings - Fork 4.3k
57 lines (48 loc) · 1.74 KB
/
Copy pathupdate-repo-ticker.yml
File metadata and controls
57 lines (48 loc) · 1.74 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
47
48
49
50
51
52
53
54
55
56
57
name: Update Repo Ticker Data
on:
schedule:
# Run every 3 hours (rotates the sampled repos several times a day)
- cron: '0 */3 * * *'
workflow_dispatch: # Allow manual trigger for testing
permissions:
contents: read
jobs:
update-ticker:
runs-on: ubuntu-latest
permissions:
contents: write # commits the refreshed ticker data + SVGs back to the repo
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Backup previous day's data
run: |
if [ -f data/repo-ticker.csv ]; then
cp data/repo-ticker.csv data/repo-ticker-previous.csv
echo "✓ Backed up previous data"
else
echo "⚠ No previous data to backup (first run)"
fi
- name: Fetch GitHub repo data
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python ticker/fetch_repo_ticker_data.py
- name: Generate ticker SVGs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python ticker/generate_ticker_svg.py
- name: Commit and push if changed
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add data/repo-ticker.csv data/repo-ticker-previous.csv assets/repo-ticker.svg
git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update repo ticker data and SVGs [skip ci]" && git push)