diff --git a/.github/workflows/update-xml.yml b/.github/workflows/update-xml.yml new file mode 100644 index 0000000..6b0d0d4 --- /dev/null +++ b/.github/workflows/update-xml.yml @@ -0,0 +1,28 @@ +name: Update Root Zone Trust Anchors + +on: + schedule: + - cron: "5 4 * * *" + workflow_dispatch: + +jobs: + update-xml: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Update XML in Go file + run: | + xml_content=$(curl -sSL https://data.iana.org/root-anchors/root-anchors.xml | sed -e 's/[\/&]/\\&/g' -e ':a;N;$!ba;s/\n/\\n/g') + sed -i '/\/\/ BEGIN XML DATA/,/\/\/ END XML DATA/c\// BEGIN XML DATA\nconst IanaRootAnchorsXml = `'"$xml_content"'`\n\n// END XML DATA' rootanchors.go + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + commit-message: "chore: update root zone trust anchors" + title: Update Root Zone Trust Anchors + body: | + This PR updates root zone trust anchors XML. Please verify the changes. + branch: update-xml diff --git a/rootanchors.go b/rootanchors.go index 4c7f391..6e15ba1 100644 --- a/rootanchors.go +++ b/rootanchors.go @@ -9,7 +9,8 @@ import ( // https://data.iana.org/root-anchors/root-anchors.xml // BEGIN IANA ROOT ANCHORS XML DATA -const ianaRootAnchorsXml = ` + +const IanaRootAnchorsXml = ` . @@ -58,7 +59,7 @@ type KeyDigest struct { func GetRawAnchors() TrustAnchor { var ta TrustAnchor - xml.Unmarshal([]byte(ianaRootAnchorsXml), &ta) + xml.Unmarshal([]byte(IanaRootAnchorsXml), &ta) return ta }