Skip to content

Commit 66e6827

Browse files
RaviTejaKNTSclaude
andcommitted
Fix repeat runs and pull request text in the TLD check
Push from a detached checkout so no local branch blocks later runs. Build the description before the commit so it lists endings, and update it on an open pull request. Keep rdap-overrides.json with the refreshed data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 51e15c2 commit 66e6827

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎content_docs/tld-directory/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Record a `checked_at` per row and show it. A directory that does not say when it
8484

8585
## Refresh
8686

87-
A homelab timer runs `scripts/domain-tools/tld-directory-monthly.mjs` on the 1st of each month at 04:30 UTC. It refreshes `tlds.json`, `rdap-bootstrap.json`, `whois-servers.json`, `whois-reviewed.json`, and `tld-directory.json` in a throwaway checkout of `main`. If a fact changed, it opens one pull request on `chore/tld-directory-refresh`. If only dates and version numbers moved, it does nothing. A failed run shows in the automation monitor.
87+
A homelab timer runs `scripts/domain-tools/tld-directory-monthly.mjs` on the 1st of each month at 04:30 UTC. It refreshes `tlds.json`, `rdap-bootstrap.json`, `rdap-overrides.json`, `whois-servers.json`, `whois-reviewed.json`, and `tld-directory.json` in a throwaway checkout of `main`. If a fact changed, it opens one pull request on `chore/tld-directory-refresh`. If only dates and version numbers moved, it does nothing. A failed run shows in the automation monitor.
8888

8989
The job doesn't add RDAP or WHOIS servers. A new ending that needs one still gets a manual review through `rdap-overrides.json` or `whois-reviewed.json`.
9090

‎scripts/domain-tools/tld-directory-monthly.mjs‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import path from "node:path";
1919

2020
const BRANCH = "chore/tld-directory-refresh";
2121
const DATA_DIR = "lib/domain/data";
22-
const DATA_FILES = ["tlds.json", "rdap-bootstrap.json", "whois-servers.json", "whois-reviewed.json", "tld-directory.json"];
22+
const DATA_FILES = ["tlds.json", "rdap-bootstrap.json", "rdap-overrides.json", "whois-servers.json", "whois-reviewed.json", "tld-directory.json"];
2323
// These move on most runs without any fact changing.
2424
const VOLATILE_KEYS = new Set(["fetchedAt", "version", "publication", "tldListVersion"]);
2525

@@ -71,17 +71,20 @@ function pullRequestBody(tree, changed) {
7171
}
7272

7373
function publish(tree, changed) {
74-
run("git", ["switch", "--quiet", "-c", BRANCH], tree);
74+
// Read the old list for the description before the commit moves HEAD.
75+
const body = pullRequestBody(tree, changed);
76+
const title = `Update TLD directory data (${new Date().toISOString().slice(0, 7)})`;
7577
run("git", ["add", "--", ...DATA_FILES.map((file) => path.posix.join(DATA_DIR, file))], tree);
76-
const month = new Date().toISOString().slice(0, 7);
77-
run("git", ["commit", "--quiet", "-m", `Update TLD directory data (${month})`], tree);
78+
run("git", ["commit", "--quiet", "-m", title], tree);
79+
// Stay detached: a local branch would outlive this checkout and block next month's run.
7880
run("git", ["push", "--quiet", "--force", "origin", `HEAD:refs/heads/${BRANCH}`], tree);
7981
const open = run("gh", ["pr", "list", "--head", BRANCH, "--state", "open", "--json", "number", "--jq", "length"], tree).trim();
8082
if (open !== "0") {
83+
run("gh", ["pr", "edit", BRANCH, "--title", title, "--body", body], tree);
8184
console.log(`Updated the open pull request on ${BRANCH}.`);
8285
return;
8386
}
84-
const url = run("gh", ["pr", "create", "--base", "main", "--head", BRANCH, "--title", `Update TLD directory data (${month})`, "--body", pullRequestBody(tree, changed)], tree).trim();
87+
const url = run("gh", ["pr", "create", "--base", "main", "--head", BRANCH, "--title", title, "--body", body], tree).trim();
8588
console.log(`Opened ${url}`);
8689
}
8790

0 commit comments

Comments
 (0)