Skip to content

Commit

Permalink
Use current job status for non workflow_run events (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 authored Jan 29, 2025
1 parent 76cc383 commit c39695c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const send = async (summary: WorkflowRunSummary, inputs: Inputs) => {
{
repository: github.context.repo.repo,
actor: github.context.actor,
currentJobStatus: inputs.githubCurrentJobStatus,
},
inputs,
)
Expand Down
6 changes: 4 additions & 2 deletions src/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FailedJob, WorkflowRunSummary } from './workflow-run.js'
type Context = {
repository: string
actor: string
currentJobStatus: string
}

export type Templates = {
Expand All @@ -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),
Expand Down

0 comments on commit c39695c

Please sign in to comment.