Skip to content

Update gov.txt from zone file #331

Update gov.txt from zone file

Update gov.txt from zone file #331

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
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