-
Notifications
You must be signed in to change notification settings - Fork 54
37 lines (35 loc) · 1.18 KB
/
update-gov-zone-file.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
34
35
36
37
name: Update gov.txt from zone file
run-name: Update gov.txt from zone file
on:
workflow_dispatch: {}
schedule:
- cron: "5 7 * * *"
jobs:
update_zone_file:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Initialize git config and sets pull to merge
run: |-
git config user.name "botgov"
git config user.email "[email protected]"
git config pull.rebase false
- name: Pull latest zone file into gov.txt
env:
CLOUDFLARE_ZONE: '${{ secrets.CLOUDFLARE_ZONE }}'
CLOUDFLARE_TOKEN: '${{ secrets.CLOUDFLARE_TOKEN }}'
run: |
chmod +x ./scripts/download_zone_file.sh
./scripts/download_zone_file.sh '${{ env.CLOUDFLARE_ZONE }}' '${{ env.CLOUDFLARE_TOKEN }}' > gov.txt
shell: sh
# Push daily zone file to branch only if a diff is found
- name: If pulled data has changes, commit and push changes to zone file.
run: |-
git add gov.txt
timestamp=$(date -u)
git commit -m "Update zone file ${timestamp}" || exit 0
git pull
git push