Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions __tests__/utils.spec.js
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -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 });
Expand Down
6 changes: 6 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -10037,6 +10038,11 @@ function buildSlackAttachments({ status, color, github }) {
value: `<https://github.com/${owner}/${repo}/actions/runs/${runId} | ${workflow}>`,
short: true,
},
{
title: 'Job',
value: `${job}`,
short: true
},
{
title: 'Status',
value: status,
Expand Down
6 changes: 6 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -36,6 +37,11 @@ function buildSlackAttachments({ status, color, github }) {
value: `<https://github.com/${owner}/${repo}/actions/runs/${runId} | ${workflow}>`,
short: true,
},
{
title: 'Job',
value: `${job}`,
short: true
},
{
title: 'Status',
value: status,
Expand Down