Skip to content

Commit

Permalink
fix: don't display steps for slack when there's no slack config (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjae Lee authored Oct 4, 2019
1 parent 0de5d68 commit eb1ab44
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 27 deletions.
23 changes: 15 additions & 8 deletions packages/shipjs/src/step/prepare/notifyPrepared.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ import { notifyPrepared } from '../../util/slack';
import runStep from '../runStep';

export default async ({ config, appName, version, pullRequestUrl }) =>
await runStep({ title: 'Notifying notifyPrepared to Slack' }, async () => {
await notifyPrepared({
config,
appName,
version,
pullRequestUrl,
});
});
await runStep(
{
title: 'Notifying notifyPrepared to Slack',
skipIf: () =>
!config.slackIncomingHook || !config.slack || !config.slack.prepared,
},
async () => {
await notifyPrepared({
config,
appName,
version,
pullRequestUrl,
});
}
);
27 changes: 18 additions & 9 deletions packages/shipjs/src/step/release/notifyReleaseStart.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ export default async ({
latestCommitHash,
latestCommitUrl,
}) =>
await runStep({ title: 'Notifying releaseStart to Slack' }, async () => {
await notifyReleaseStart({
config,
appName,
version,
latestCommitHash,
latestCommitUrl,
});
});
await runStep(
{
title: 'Notifying releaseStart to Slack',
skipIf: () =>
!config.slackIncomingHook ||
!config.slack ||
!config.slack.releaseStart,
},
async () => {
await notifyReleaseStart({
config,
appName,
version,
latestCommitHash,
latestCommitUrl,
});
}
);
29 changes: 19 additions & 10 deletions packages/shipjs/src/step/release/notifyReleaseSuccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ export default async ({
latestCommitUrl,
repoURL,
}) =>
await runStep({ title: 'Notifying releaseSuccess to Slack' }, async () => {
await notifyReleaseSuccess({
config,
appName,
version,
latestCommitHash,
latestCommitUrl,
repoURL,
});
});
await runStep(
{
title: 'Notifying releaseSuccess to Slack',
skipIf: () =>
!config.slackIncomingHook ||
!config.slack ||
!config.slack.releaseSuccess,
},
async () => {
await notifyReleaseSuccess({
config,
appName,
version,
latestCommitHash,
latestCommitUrl,
repoURL,
});
}
);

0 comments on commit eb1ab44

Please sign in to comment.