diff --git a/AGENTS.md b/AGENTS.md index 307be21..0173fc6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -199,7 +199,7 @@ tests/__snapshots__/ # formatter snapshot golden files (toMatchSnapshot) - Milestone progress bars (🟢🟡🟠⬜) are data visualization and are exempt from the emoji toggle. - `workflow_run` messages render a **Jobs** field as a Discord `diff` fenced code block (`server/lib/formatters/workflow.ts`): one line per job, `${marker} ${name} ${emoji}${status}` plus - ` · {duration}` for completed jobs. `+` (green) for `success`, `-` (red) for other non-pending + `· {duration}` for completed jobs. `+` (green) for `success`, `-` (red) for other non-pending conclusions, a plain space for running/queued/pending; job names clamp to 200 chars and the field to the platform field limit. Drivers without diff support (Telegram, Feishu) collapse it to inline code. - Commit hashes, branches and tags render as inline code wrapped in a hyperlink diff --git a/server/lib/formatters/workflow.ts b/server/lib/formatters/workflow.ts index 7f353fc..9e8d121 100644 --- a/server/lib/formatters/workflow.ts +++ b/server/lib/formatters/workflow.ts @@ -155,7 +155,7 @@ export function formatWorkflowRun( ? "running" : j.status === "queued" ? "queued" - : j.conclusion ?? "pending"; + : (j.conclusion ?? "pending"); const emoji = WORKFLOW_CONCLUSION_EMOJI[status] ?? "⏳"; const marker = status === "success" @@ -163,8 +163,7 @@ export function formatWorkflowRun( : status === "running" || status === "queued" || status === "pending" ? " " : "-"; - const done = - status !== "running" && status !== "queued" && status !== "pending"; + const done = status !== "running" && status !== "queued" && status !== "pending"; const duration = done ? jobDuration(j.started_at, j.completed_at) : undefined; return `${marker} ${cap(j.name ?? "", 200)} ${em(emoji)}${status}${duration ? ` · ${duration}` : ""}`; }); diff --git a/tests/formatter.test.ts b/tests/formatter.test.ts index af266ef..5a7fd8a 100644 --- a/tests/formatter.test.ts +++ b/tests/formatter.test.ts @@ -165,10 +165,22 @@ describe("message title spec", () => { html_url: "https://github.com/acme/widget/actions/runs/42", run_number: 42, jobs: [ - { name: "build", status: "completed", conclusion: "success", started_at: "2024-01-01T00:00:00Z", completed_at: "2024-01-01T00:01:23Z" }, + { + name: "build", + status: "completed", + conclusion: "success", + started_at: "2024-01-01T00:00:00Z", + completed_at: "2024-01-01T00:01:23Z", + }, { name: "deploy", status: "in_progress", conclusion: null }, { name: "lint", status: "queued", conclusion: null }, - { name: "test", status: "completed", conclusion: "failure", started_at: "2024-01-01T00:00:00Z", completed_at: "2024-01-01T00:00:45Z" }, + { + name: "test", + status: "completed", + conclusion: "failure", + started_at: "2024-01-01T00:00:00Z", + completed_at: "2024-01-01T00:00:45Z", + }, ], }, repository: repo,