Implement NS record review comment in PR workflow

Add a comment action for NS record reviews in PRs.
This commit is contained in:
William Harrison authored and GitHub committed 2026-08-19 14:13:44 +08:00
1 parent c66a6e9a16
commit 27c20f6a66
1 file changed
+43
+43
View File
@@ -100,6 +100,49 @@ jobs:
core.setOutput("changed", "false");
- name: Comment about NS records
if: steps.ns.outputs.changed == 'true'
uses: actions/github-script@v8
with:
github-token: ${{ secrets.BOT }}
script: |
const marker = "<!-- is-a-dev-bot: ns-record-review -->";
const comments = await github.paginate(
github.rest.issues.listComments,
{
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
}
);
const alreadyCommented = comments.some(
(comment) =>
comment.user?.login === "is-a-dev-bot" &&
comment.body?.includes(marker)
);
if (!alreadyCommented) {
const body = [
marker,
"## ⚠️ NS record review required",
"",
"This pull request contains a request for NS records and will need to be reviewed by the service owner.",
"",
"Please ensure you have provided reasoning for needing NS records in your PR description, otherwise your request cannot be approved.",
"---",
"***Do not mention the owner on this PR, he has already been notified.***"
].join("\n");
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
}
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.event.repository.default_branch }}