diff --git a/__tests__/utils.spec.js b/__tests__/utils.spec.js index fe5bea01..d222c8d6 100644 --- a/__tests__/utils.spec.js +++ b/__tests__/utils.spec.js @@ -1,6 +1,7 @@ import { formatChannelName, buildSlackAttachments } from '../src/utils'; import { GITHUB_PUSH_EVENT, GITHUB_PR_EVENT } from '../fixtures'; const runId = parseInt(process.env.GITHUB_RUN_ID, 10); +const job = process.env.GITHUB_JOB; describe('Utils', () => { describe('formatChannelName', () => { @@ -30,6 +31,16 @@ describe('Utils', () => { }); }); + it('shows job', () => { + const attachments = buildSlackAttachments({ status: 'STARTED', color: 'good', github: GITHUB_PUSH_EVENT }); + + expect(attachments[0].fields.find(a => a.title === 'Job')).toEqual({ + title: 'Job', + value: `${job}`, + short: true, + }); + }); + describe('for push events', () => { it('links to the action workflow', () => { const attachments = buildSlackAttachments({ status: 'STARTED', color: 'good', github: GITHUB_PUSH_EVENT }); diff --git a/dist/index.js b/dist/index.js index bb42a213..1df9fe28 100644 --- a/dist/index.js +++ b/dist/index.js @@ -10009,6 +10009,7 @@ function buildSlackAttachments({ status, color, github }) { const sha = event === 'pull_request' ? payload.pull_request.head.sha : github.context.sha; const runId = parseInt(process.env.GITHUB_RUN_ID, 10); + const job = process.env.GITHUB_JOB const referenceLink = event === 'pull_request' @@ -10037,6 +10038,11 @@ function buildSlackAttachments({ status, color, github }) { value: ``, short: true, }, + { + title: 'Job', + value: `${job}`, + short: true + }, { title: 'Status', value: status, diff --git a/src/utils.js b/src/utils.js index 3faabd10..fe52cc20 100644 --- a/src/utils.js +++ b/src/utils.js @@ -8,6 +8,7 @@ function buildSlackAttachments({ status, color, github }) { const sha = event === 'pull_request' ? payload.pull_request.head.sha : github.context.sha; const runId = parseInt(process.env.GITHUB_RUN_ID, 10); + const job = process.env.GITHUB_JOB; const referenceLink = event === 'pull_request' @@ -36,6 +37,11 @@ function buildSlackAttachments({ status, color, github }) { value: ``, short: true, }, + { + title: 'Job', + value: `${job}`, + short: true + }, { title: 'Status', value: status,