From c39695cafceae4033b0aec0199446bbbd36e4095 Mon Sep 17 00:00:00 2001 From: Hidetake Iwata Date: Wed, 29 Jan 2025 18:54:45 +0900 Subject: [PATCH] Use current job status for non workflow_run events (#252) --- src/run.ts | 1 + src/slack.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/run.ts b/src/run.ts index f137d69..95d19cf 100644 --- a/src/run.ts +++ b/src/run.ts @@ -48,6 +48,7 @@ const send = async (summary: WorkflowRunSummary, inputs: Inputs) => { { repository: github.context.repo.repo, actor: github.context.actor, + currentJobStatus: inputs.githubCurrentJobStatus, }, inputs, ) diff --git a/src/slack.ts b/src/slack.ts index 396344c..a005422 100644 --- a/src/slack.ts +++ b/src/slack.ts @@ -4,6 +4,7 @@ import { FailedJob, WorkflowRunSummary } from './workflow-run.js' type Context = { repository: string actor: string + currentJobStatus: string } export type Templates = { @@ -12,13 +13,14 @@ export type Templates = { } export const getSlackBlocks = (w: WorkflowRunSummary, c: Context, templates: Templates): KnownBlock[] => { - const conclusion = w.conclusion?.toLocaleLowerCase() ?? '' + // When the current workflow run is still running, use the current job status. + const conclusion = w.conclusion ?? c.currentJobStatus return [ { type: 'section', text: { type: 'mrkdwn', - text: `Workflow *<${w.workflowRunUrl}|${w.workflowName}>* ${conclusion}`, + text: `Workflow *<${w.workflowRunUrl}|${w.workflowName}>* ${conclusion.toLocaleLowerCase()}`, }, }, ...getFailedJobBlocks(w, templates),