mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-23 00:21:28 +00:00
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:
parent
bf76b9342f
commit
b35c2c2f90
13 changed files with 31 additions and 15 deletions
|
|
@ -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", () => {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue