-
Notifications
You must be signed in to change notification settings - Fork 31
36 lines (28 loc) · 1.1 KB
/
check-zonefile.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
name: Zone File Validation
# Trigger the workflow on pull requests that modify the db.ngo.us file
on:
pull_request:
paths:
- 'db.ngo.us'
jobs:
check-zonefile:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository code
- name: Checkout Code
uses: actions/checkout@v3
# Step 2: Install BIND utilities (which include named-checkzone)
- name: Install BIND Utilities
run: sudo apt-get update && sudo apt-get install -y bind9-utils
# Step 3: Run named-checkzone to validate the zone file
- name: Validate Zone File
run: |
ZONE_FILE="db.ngo.us"
ZONE_NAME="ngo.us"
TEMP_ZONE_FILE="temp_$ZONE_FILE"
# Step 3a: Replace placeholder 'YYYYMMDDNN' with a dummy value in a temporary file
sed 's/YYYYMMDDNN/1900010101/g' $ZONE_FILE > $TEMP_ZONE_FILE
# Step 3b: Run named-checkzone to validate the modified zone file
named-checkzone $ZONE_NAME $TEMP_ZONE_FILE || { echo "Zone file validation failed!"; exit 1; }
# Clean up
rm $TEMP_ZONE_FILE