feat: unified command ack messages with expectations (6.3)
This commit is contained in:
1 parent
a35587e2ef
commit
3408c9dc77
3 files changed
+35
-2
No files matched your search
@@ -14,6 +14,23 @@ export function formatPermissionDeniedMessage(
|
|||||||
].join(" ");
|
].join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function formatCommandAckMessage(
|
||||||
|
commenterLogin: string,
|
||||||
|
actorName: string,
|
||||||
|
command: "/recheck" | "/conflict"
|
||||||
|
): string {
|
||||||
|
if (command === "/recheck") {
|
||||||
|
return [
|
||||||
|
`${actorName} received \`/recheck\` requested by @${commenterLogin}.`,
|
||||||
|
"The full review is running now with the repository's current strictness settings; the result will be posted in this conversation when it completes."
|
||||||
|
].join(" ");
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
`${actorName} received \`/conflict\` requested by @${commenterLogin}.`,
|
||||||
|
"Conflict repair can take up to 45 minutes (editing, isolated validation, and a final safety confirmation). A follow-up comment will report the outcome, and nothing is pushed unless every guard passes."
|
||||||
|
].join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
export async function postPermissionDeniedComment(
|
export async function postPermissionDeniedComment(
|
||||||
octokit: Octokit,
|
octokit: Octokit,
|
||||||
params: {
|
params: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { Octokit } from "@octokit/rest";
|
import type { Octokit } from "@octokit/rest";
|
||||||
import { config } from "../config.js";
|
import { config } from "../config.js";
|
||||||
import { requiredChecksAreGreen } from "../github/checks.js";
|
import { requiredChecksAreGreen } from "../github/checks.js";
|
||||||
import { postPermissionDeniedComment } from "../github/commandFeedback.js";
|
import { postPermissionDeniedComment, formatCommandAckMessage } from "../github/commandFeedback.js";
|
||||||
import { formatBotDisplayName } from "../github/botIdentity.js";
|
import { formatBotDisplayName } from "../github/botIdentity.js";
|
||||||
import { collectValidNewLines, toDiffPosition } from "../github/diff.js";
|
import { collectValidNewLines, toDiffPosition } from "../github/diff.js";
|
||||||
import { listPullRequestFiles } from "../github/pulls.js";
|
import { listPullRequestFiles } from "../github/pulls.js";
|
||||||
@@ -641,7 +641,7 @@ export async function processRecheckComment(
|
|||||||
owner: params.owner,
|
owner: params.owner,
|
||||||
repo: params.repo,
|
repo: params.repo,
|
||||||
issue_number: params.pullNumber,
|
issue_number: params.pullNumber,
|
||||||
body: `Recheck requested by @${params.commenterLogin}. Re-running the review with the repository's current strictness settings.`
|
body: formatCommandAckMessage(params.commenterLogin, conflictAutomationName(), "/recheck")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import { formatCommandAckMessage } from "../src/github/commandFeedback.js";
|
||||||
|
|
||||||
|
test("recheck ack names the requester and sets expectations", () => {
|
||||||
|
const message = formatCommandAckMessage("alice", "ghbot bot", "/recheck");
|
||||||
|
assert.match(message, /@alice/);
|
||||||
|
assert.match(message, /`\/recheck`/);
|
||||||
|
assert.match(message, /running now/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("conflict ack states the time budget and push guard", () => {
|
||||||
|
const message = formatCommandAckMessage("bob", "ghbot bot", "/conflict");
|
||||||
|
assert.match(message, /45 minutes/);
|
||||||
|
assert.match(message, /nothing is pushed unless every guard passes/);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user