From 8189fb3863d27e3ba6e4de0a7eb08fa0286e5903 Mon Sep 17 00:00:00 2001 From: pam- Date: Mon, 1 Mar 2021 16:40:28 -0500 Subject: [PATCH] feat: adding job name in Slack message syntax --- fixtures.js | 4 ++++ src/utils.js | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/fixtures.js b/fixtures.js index db97e326..34e8893b 100644 --- a/fixtures.js +++ b/fixtures.js @@ -14,6 +14,8 @@ export const GITHUB_PUSH_EVENT = { workflow: 'CI', eventName: 'push', sha: 'abc123', + job: 'ci', + runId: 12345 }, }; @@ -33,5 +35,7 @@ export const GITHUB_PR_EVENT = { workflow: 'CI', eventName: 'pull_request', sha: 'abc123', + job: 'ci', + runId: 12345 }, }; diff --git a/src/utils.js b/src/utils.js index 419ad24d..ec546a6e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,7 +1,7 @@ -const { context } = require('@actions/github'); +const { context } = require('@actions/github-script'); function buildSlackAttachments({ status, color, github }) { - const { payload, ref, workflow, eventName } = github.context; + const { payload, ref, workflow, eventName, job, runId } = github.context; const { owner, repo } = context.repo; const event = eventName; const branch = event === 'pull_request' ? payload.pull_request.head.ref : ref.replace('refs/heads/', ''); @@ -26,8 +26,13 @@ function buildSlackAttachments({ status, color, github }) { color, fields: [ { - title: 'Action', - value: ``, + title: 'Workflow', + value: ``, + short: true, + }, + { + title: 'Job', + value: ``, short: true, }, {