-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (28 loc) · 906 Bytes
/
zones.yml
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
name: Zones
on:
# schedule:
# - cron: '0 2 * * *'
workflow_dispatch:
jobs:
fetch_zones:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Get all Cloudflare Zones
run: |
curl -X GET "https://api.cloudflare.com/client/v4/zones" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type: application/json" | jq '.result[] | .name' > zones.json
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Commit and push if it's updated
run: |
git config user.name "GitHub Action"
git config user.email "[email protected]"
git add -A
timestamp=$(date -u)
git commit -m "Updated zones.json on ${timestamp}" || exit 0
git push
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}