Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Route triage comments through dedicated identity

Richard Courtmanaf370a8dda01
diff --git a/.github/scripts/issue-version-triage.cjs b/.github/scripts/issue-version-triage.cjs
index b333ae2037..3e0655ef0a 100644
--- a/.github/scripts/issue-version-triage.cjs
+++ b/.github/scripts/issue-version-triage.cjs
@@ -2,6 +2,9 @@ const VERSION_LABEL_PREFIX = "affects-";
const NEEDS_VERSION_LABEL = "needs-version-info";
const RETEST_LABEL = "needs-retest-on-latest";
const RETEST_COMMENT_MARKER = "<!-- issue-version-triage:v1 -->";
+const CLOSE_COMMENT_MARKER = "<!-- issue-timeout-close:v1 -->";
+const TRIAGE_FOOTER =
+ "[How Pulse handles triage](https://github.com/rcourtman/Pulse/blob/main/docs/AI_TRANSPARENCY.md)";
const BUG_LABEL = "bug";
const DOCS_LABEL = "documentation";
const ENHANCEMENT_LABEL = "enhancement";
@@ -181,8 +184,13 @@ function keepOnlyReportedVersionLabel(nextLabels, reportedVersion) {
}
}
+function withTriageFooter(lines) {
+ const body = Array.isArray(lines) ? lines.join("\n") : String(lines || "");
+ return `${body.trimEnd()}\n\n${TRIAGE_FOOTER}`;
+}
+
function buildRetestCommentBody(reportedVersion, latestVersion) {
- return [
+ return withTriageFooter([
RETEST_COMMENT_MARKER,
"Thanks for the report.",
"",
@@ -196,7 +204,16 @@ function buildRetestCommentBody(reportedVersion, latestVersion) {
"If there is no reporter follow-up after 7 days, this issue may be auto-closed until new confirmation is provided.",
"",
"If it still reproduces on the latest version, I will keep this open as an active regression.",
- ].join("\n");
+ ]);
+}
+
+function buildTimeoutCloseCommentBody(staleDays) {
+ return withTriageFooter([
+ CLOSE_COMMENT_MARKER,
+ `Closing due to missing reporter retest confirmation for ${staleDays} days.`,
+ "",
+ "If this still reproduces on the latest stable release, comment with updated version details and logs and I will reopen.",
+ ]);
}
function canPostRetestComment(issue, action) {
@@ -325,13 +342,16 @@ module.exports = {
postRetestComment,
internals: {
BUG_LABEL,
+ CLOSE_COMMENT_MARKER,
DOCS_LABEL,
ENHANCEMENT_LABEL,
NEEDS_VERSION_LABEL,
RETEST_COMMENT_MARKER,
RETEST_LABEL,
+ TRIAGE_FOOTER,
VERSION_LABEL_PREFIX,
buildRetestCommentBody,
+ buildTimeoutCloseCommentBody,
buildTriageState,
canPostRetestComment,
classifyV6FeedbackType,
diff --git a/.github/scripts/issue-version-triage.test.cjs b/.github/scripts/issue-version-triage.test.cjs
index 7610fa0c17..32a384d4ea 100644
--- a/.github/scripts/issue-version-triage.test.cjs
+++ b/.github/scripts/issue-version-triage.test.cjs
@@ -143,6 +143,24 @@ test("postRetestComment comments once for older non-maintainer bug reports", asy
calls.createComment[0].body,
/<!-- issue-version-triage:v1 -->/
);
+ assert.ok(
+ calls.createComment[0].body.endsWith(`\n\n${triage.internals.TRIAGE_FOOTER}`)
+ );
+ assert.equal(
+ calls.createComment[0].body.split(triage.internals.TRIAGE_FOOTER).length - 1,
+ 1
+ );
+});
+
+test("timeout close comments use the canonical triage footer", () => {
+ const { buildTimeoutCloseCommentBody, CLOSE_COMMENT_MARKER, TRIAGE_FOOTER } =
+ triage.internals;
+ const body = buildTimeoutCloseCommentBody(7);
+
+ assert.ok(body.startsWith(CLOSE_COMMENT_MARKER));
+ assert.ok(body.endsWith(`\n\n${TRIAGE_FOOTER}`));
+ assert.equal(body.split(TRIAGE_FOOTER).length - 1, 1);
+ assert.doesNotMatch(body, /automated maintainer|supervised by|AI\)/i);
});
test("postRetestComment skips reopened issues", async () => {
diff --git a/.github/scripts/triage-comment-policy.test.cjs b/.github/scripts/triage-comment-policy.test.cjs
new file mode 100644
index 0000000000..251a7a462f
--- /dev/null
+++ b/.github/scripts/triage-comment-policy.test.cjs
@@ -0,0 +1,44 @@
+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 commentPublisherPatterns = [
+ /github\.rest\.issues\.createComment/,
+ /github\.rest\.pulls\.createReviewComment/,
+ /addDiscussionComment/,
+ /postRetestComment/,
+];
+
+test("automated workflow comments 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 (!commentPublisherPatterns.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(), [
+ "close-needs-retest-timeout.yml",
+ "issue-version-retest-comment.yml",
+ ]);
+});
diff --git a/.github/workflows/close-needs-retest-timeout.yml b/.github/workflows/close-needs-retest-timeout.yml
index 9bbf9e5b43..0efcf6b0ea 100644
--- a/.github/workflows/close-needs-retest-timeout.yml
+++ b/.github/workflows/close-needs-retest-timeout.yml
@@ -16,24 +16,41 @@ on:
permissions:
contents: read
- issues: write
jobs:
close-timeouts:
runs-on: ubuntu-24.04
steps:
+ - name: Mint triage bot token
+ id: triage-token
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
+ with:
+ app-id: 2484142
+ private-key: ${{ secrets.PULSE_TRIAGE_APP_PRIVATE_KEY }}
+
+ - name: Check out triage helper
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
+ with:
+ sparse-checkout: |
+ .github/scripts/issue-version-triage.cjs
+ sparse-checkout-cone-mode: false
+
- name: Auto-close outdated retest issues
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
env:
STALE_DAYS: ${{ github.event.inputs.stale_days || '7' }}
DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
with:
+ github-token: ${{ steps.triage-token.outputs.token }}
script: |
+ const triage = require(`${process.env.GITHUB_WORKSPACE}/.github/scripts/issue-version-triage.cjs`);
+ const {
+ RETEST_COMMENT_MARKER,
+ buildTimeoutCloseCommentBody,
+ } = triage.internals;
const RETEST_LABEL = "needs-retest-on-latest";
const OPT_OUT_LABEL = "no-auto-close";
const CLOSED_LABEL = "closed-needs-retest-timeout";
- const RETEST_COMMENT_MARKER = "<!-- issue-version-triage:v1 -->";
- const CLOSE_COMMENT_MARKER = "<!-- issue-timeout-close:v1 -->";
const staleDaysRaw = process.env.STALE_DAYS || "7";
const staleDays = Number.parseInt(staleDaysRaw, 10);
@@ -152,12 +169,7 @@ jobs:
continue;
}
- const closeCommentBody = [
- CLOSE_COMMENT_MARKER,
- `Closing due to missing reporter retest confirmation for ${staleDays} days.`,
- "",
- "If this still reproduces on the latest stable release, comment with updated version details and logs and I will reopen.",
- ].join("\n");
+ const closeCommentBody = buildTimeoutCloseCommentBody(staleDays);
if (dryRun) {
core.info(`[dry-run] Would close #${issue.number}`);
diff --git a/.github/workflows/issue-version-retest-comment.yml b/.github/workflows/issue-version-retest-comment.yml
index 3e5d5c4a3e..76b1d384c4 100644
--- a/.github/workflows/issue-version-retest-comment.yml
+++ b/.github/workflows/issue-version-retest-comment.yml
@@ -7,13 +7,19 @@ on:
permissions:
contents: read
- issues: write
jobs:
comment:
if: ${{ github.event.issue.pull_request == null }}
runs-on: ubuntu-24.04
steps:
+ - name: Mint triage bot token
+ id: triage-token
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
+ with:
+ app-id: 2484142
+ private-key: ${{ secrets.PULSE_TRIAGE_APP_PRIVATE_KEY }}
+
- name: Check out triage helper
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
@@ -24,6 +30,7 @@ jobs:
- name: Post retest guidance when needed
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
+ github-token: ${{ steps.triage-token.outputs.token }}
script: |
const triage = require(`${process.env.GITHUB_WORKSPACE}/.github/scripts/issue-version-triage.cjs`);
await triage.postRetestComment({ github, context, core });