Skip to content

Commit

Permalink
Automate removing domains without ns records
Browse files Browse the repository at this point in the history
  • Loading branch information
nickspaargaren committed Aug 4, 2024
1 parent 325f988 commit 6521e74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/dns-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ jobs:
continue-on-error: true
steps:
- uses: actions/checkout@v2
- run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
name: Python setup
- uses: actions/setup-python@v2
with:
Expand All @@ -17,3 +20,7 @@ jobs:
run: |
cd scripts
python3 dnscheck.py
- name: Commit updated pihole-google.txt
run: |
git add pihole-google.txt && git commit -am "Remove domains without NS records"
git push
7 changes: 7 additions & 0 deletions scripts/dnscheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def check_domain(domain):

def main():
found_domains = 0
domains_with_ns_records = []

with open("../pihole-google.txt") as f:
for line in f:
Expand All @@ -23,6 +24,12 @@ def main():
if check_domain(domain):
print(f"Domain without NS records: {domain}")
found_domains += 1
else:
domains_with_ns_records.append(line)

# Write remaining domains back to the file
with open("../pihole-google.txt", "w") as f:
f.writelines(domains_with_ns_records)

if found_domains > 0:
sys.exit(1)
Expand Down

0 comments on commit 6521e74

Please sign in to comment.