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 committed 2026-08-13 06:47:30 +08:00
1 parent bf76b9342f
commit b35c2c2f90
13 files changed
+31 -15

No files matched your search

+14
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", () => {
+2
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,