Move RDAP DNS data next to domain_expiry.js and add CI auto-update

Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-19 16:12:04 +00:00
parent 8aa8547ec6
commit 9edc2e3011
4 changed files with 93 additions and 3 deletions

45
.github/workflows/update-rdap-dns.yml vendored Normal file
View File

@ -0,0 +1,45 @@
name: Update RDAP DNS Data
on:
schedule:
# Run on the 1st of every month at 00:00 UTC
- cron: '0 0 1 * *'
workflow_dispatch:
permissions:
contents: write
jobs:
update-rdap-dns:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 20
- name: Update RDAP DNS data
run: node extra/update-rdap-dns.mjs
- name: Check for changes
id: changes
run: |
if git diff --quiet server/model/rdap-dns.json; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.changes.outputs.changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add server/model/rdap-dns.json
git commit -m "chore: update RDAP DNS data from IANA [skip ci]"
git push

45
extra/update-rdap-dns.mjs Normal file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env node
/**
* Update RDAP DNS data from IANA
* This script downloads the latest RDAP bootstrap file from IANA and updates the local file.
*/
import { writeFileSync } from "fs";
import { join, dirname } from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const RDAP_DNS_URL = "https://data.iana.org/rdap/dns.json";
const OUTPUT_PATH = join(__dirname, "..", "server", "model", "rdap-dns.json");
console.log("Downloading RDAP DNS data from IANA...");
try {
const response = await fetch(RDAP_DNS_URL);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const data = await response.json();
// Validate that we have the expected structure
if (!data.services || !Array.isArray(data.services)) {
throw new Error("Invalid RDAP DNS data structure");
}
console.log(`Found ${data.services.length} RDAP services`);
console.log(`Publication date: ${data.publication}`);
// Write the file with proper formatting
writeFileSync(OUTPUT_PATH, JSON.stringify(data, null, 2) + "\n", "utf8");
console.log(`✓ Successfully updated ${OUTPUT_PATH}`);
process.exit(0);
} catch (error) {
console.error("✗ Failed to update RDAP DNS data:");
console.error(error.message);
process.exit(1);
}

View File

@ -7,8 +7,8 @@ const { Notification } = require("../notification");
const TranslatableError = require("../translatable-error");
const dayjs = require("dayjs");
// Load static RDAP DNS data from local file
const rdapDnsData = require("../data/rdap-dns.json");
// Load static RDAP DNS data from local file (auto-updated by CI)
const rdapDnsData = require("./rdap-dns.json");
/**
* Find the RDAP server for a given TLD

View File

@ -5363,4 +5363,4 @@
]
],
"version": "1.0"
}
}