update-zone #397
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow used for daily updates of the .ch zone file | |
name: update-zone | |
# Controls when the workflow will run | |
on: | |
schedule: | |
- cron: '45 0 * * *' | |
jobs: | |
update-zone: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# make sure dig is installed | |
- name: Install package dnsutils | |
run: sudo apt-get install dnsutils | |
# do the zone transfer | |
- name: Zone transfer | |
run: dig -y hmac-sha512:tsig-zonedata-ch-public-21-01:stZwEGApYumtXkh73qMLPqfbIDozWKZLkqRvcjKSpRnsor6A6MxixRL6C2HeSVBQNfMW4wer+qjS0ZSfiWiJ3Q== @zonedata.switch.ch +noall +answer +noidnout +onesoa AXFR ch. > ch.txt | |
# extract domains | |
- name: Extract domains | |
run: grep -P "IN\tNS" ch.txt | awk '{print $1}' | sort | uniq > ch_uniq.txt | |
# commit back to repo | |
- name: Commit new domains | |
run: | | |
git config --global user.name 'Antoine Neuenschwander' | |
git config --global user.email '[email protected]' | |
git add ch_uniq.txt | |
git commit -m $(head -1 ch.txt | awk '{print $7}') | |
git push | |