feat(check_run): edit messages in place as the run progresses, like workflow_run

formatCheckRun now sets a stable updateKey (check_run:{repo}:{id}) so queued → in_progress → completed phases update the original message via KV msg:* tracking instead of posting new ones. Adds tests and syncs README/docs.
This commit is contained in:
RhenCloud 2026-08-13 06:47:30 +08:00
parent bf76b9342f
commit b35c2c2f90
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
13 changed files with 31 additions and 15 deletions

View file

@ -137,6 +137,7 @@ describe("message title spec", () => {
it("check_run uses status for queued and running", () => {
const checkRun = {
id: 42,
name: "Lint",
html_url: "https://github.com/acme/widget/runs/1",
conclusion: null as string | null,
@ -148,6 +149,19 @@ describe("message title spec", () => {
);
expect(msg.title).toBe("acme/widget: Lint — running");
expect(msg.fields![0].value).toBe("🔄 running");
expect(msg.updateKey).toBe("check_run:acme/widget:42");
});
it("check_run omits updateKey without a run id", () => {
const msg = formatEvent(
route,
event("check_run", {
check_run: { name: "Lint", status: "completed", conclusion: "success" },
repository: repo,
sender,
}),
);
expect(msg.updateKey).toBeUndefined();
});
it("check_suite shows conclusion, service, branch and commit", () => {

View file

@ -164,6 +164,7 @@ export function formatCheckRun(
showEmoji: boolean,
): NeutralMessage {
const checkRun = payload.check_run as {
id?: number;
name?: string;
conclusion?: string;
html_url?: string;
@ -213,6 +214,7 @@ export function formatCheckRun(
url: checkRun.html_url,
color: GITHUB_COLORS[colorKey],
fields,
updateKey: repo && checkRun.id != null ? `check_run:${repo}:${checkRun.id}` : undefined,
},
t,
repo,