Files
pulse/.github/scripts/triage-comment-policy.test.cjs
T
pulse-triage[bot] 590b80cfe7 fix(triage): retire version-only retest posting and timeout closure
An older reported version does not establish a relevant released fix, and silence after generic advice does not justify closing an unresolved report. Retire both scheduled paths and retain no-write compatibility entry points. Preserve metadata classification while leaving retest state to Community's evidence-backed whole-thread review. Focused regression tests cover both entry points, label ownership and workflow retirement.

Change-source: pulse-maintainer
2026-09-08 11:32:57 +01:00

57 lines
1.9 KiB
JavaScript

const test = require("node:test");
const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const workflowDir = path.resolve(__dirname, "../workflows");
const issueMutationPatterns = [
/github\.rest\.issues\.createComment/,
/github\.rest\.pulls\.createReviewComment/,
/addDiscussionComment/,
/post(?:Eligible)?RetestComments?/,
/syncLabels/,
];
test("automated workflow issue mutations use the dedicated triage identity", () => {
const publishers = [];
for (const name of fs.readdirSync(workflowDir)) {
if (!name.endsWith(".yml") && !name.endsWith(".yaml")) continue;
const workflow = fs.readFileSync(path.join(workflowDir, name), "utf8");
if (!issueMutationPatterns.some((pattern) => pattern.test(workflow))) continue;
publishers.push(name);
assert.match(
workflow,
/actions\/create-github-app-token@[0-9a-f]{40}/,
`${name} must mint a pinned GitHub App token`
);
assert.match(
workflow,
/private-key: \$\{\{ secrets\.PULSE_TRIAGE_APP_PRIVATE_KEY \}\}/,
`${name} must use the triage App private key`
);
assert.match(
workflow,
/github-token: \$\{\{ steps\.triage-token\.outputs\.token \}\}/,
`${name} must pass the triage App token to github-script`
);
}
assert.deepEqual(publishers.sort(), [
"issue-version-label-sync.yml",
]);
});
test("version-only posting and timeout closure workflows are retired", () => {
for (const name of ["issue-version-retest-comment.yml", "close-needs-retest-timeout.yml"]) {
assert.equal(fs.existsSync(path.join(workflowDir, name)), false, name);
}
for (const name of fs.readdirSync(workflowDir)) {
if (!/\.ya?ml$/.test(name)) continue;
const source = fs.readFileSync(path.join(workflowDir, name), "utf8");
assert.doesNotMatch(source, /post(?:Eligible)?RetestComments?|issue-version-triage:v1|buildTimeoutCloseCommentBody/, name);
}
});