Skip to content

sync Cloudflare edge PoPs #21

sync Cloudflare edge PoPs

sync Cloudflare edge PoPs #21

name: sync Cloudflare edge PoPs
on:
schedule:
- cron: "0 6 */3 * *"
push:
paths:
- "scripts/sync_cloudflare_pops.py"
workflow_dispatch:
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run sync script
run: python scripts/sync_cloudflare_pops.py --data assets/data/cloudflare-edge-locations.json
- name: Check for changes
id: diff
run: |
git diff --quiet assets/data/cloudflare-edge-locations.json \
&& echo "changed=false" >> "$GITHUB_OUTPUT" \
|| echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Commit and push updated JSON
if: steps.diff.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add assets/data/cloudflare-edge-locations.json
git commit -m "chore: sync Cloudflare edge PoPs [skip ci]"
git push
- name: No changes detected
if: steps.diff.outputs.changed == 'false'
run: echo "assets/data/cloudflare-edge-locations.json is already up-to-date."
- name: Commit run log
if: always()
run: |
mkdir -p scripts/logs
cp scripts/sync-cloudflare-pops.log "scripts/logs/$(date -u +%Y-%m-%d_%H-%M-%S).log"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add scripts/logs/
git diff --cached --quiet || git commit -m "chore: add sync run log [skip ci]"
git push