Skip to content

Commit

Permalink
build(ci): update anchors with action
Browse files Browse the repository at this point in the history
  • Loading branch information
developStorm committed Oct 10, 2024
1 parent 21eb9e4 commit 82931d0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/update-xml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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: |
# Replace the content between the XML data anchor comments
xml_content=$(curl -sSL https://data.iana.org/root-anchors/root-anchors.xml)
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
5 changes: 3 additions & 2 deletions rootanchors.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (

// https://data.iana.org/root-anchors/root-anchors.xml
// BEGIN IANA ROOT ANCHORS XML DATA
const ianaRootAnchorsXml = `<?xml version="1.0" encoding="UTF-8"?>

const IanaRootAnchorsXml = `<?xml version="1.0" encoding="UTF-8"?>
<TrustAnchor id="E9724F53-1851-4F86-85E5-F1392102940B" source="http://data.iana.org/root-anchors/root-anchors.xml">
<Zone>.</Zone>
<KeyDigest id="Kjqmt7v" validFrom="2010-07-15T00:00:00+00:00" validUntil="2019-01-11T00:00:00+00:00">
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 82931d0

Please sign in to comment.