Skip to content

Update Statistics

Update Statistics #260

Workflow file for this run

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