-
Notifications
You must be signed in to change notification settings - Fork 216
50 lines (50 loc) · 1.53 KB
/
Copy pathupdate_stats.yml
File metadata and controls
50 lines (50 loc) · 1.53 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
name: Update Statistics
on:
schedule:
- cron: "0 1 * * *"
workflow_dispatch:
concurrency:
group: stats-updates
cancel-in-progress: false
jobs:
stats:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Calculate statistics
run: python scripts/calculate_stats.py
- name: Update daily gist
continue-on-error: true
env:
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
GIST_ID: ${{ secrets.GIST_ID }}
run: python scripts/update_gist.py
- name: Commit and push
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add dns/*.json archives/ dns/stats_snapshot.json
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "Update statistics [skip ci]"
for i in {1..5}; do
git pull --rebase -X theirs origin main && git push && exit 0
git rebase --abort 2>/dev/null || true
echo "Push attempt $i failed, retrying in $((i * 3))s..."
sleep $((i * 3))
done
exit 1