Skip to content

Commit

Permalink
fix: skip notification when args not given (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjae Lee authored Aug 20, 2019
1 parent c0388cb commit b0be6bf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/shipjs/src/util/slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IncomingWebhook } from '@slack/webhook';
async function sendSlackMessage({ config, sendArguments }) {
const { slackIncomingHook, slack } = config;

if (!slackIncomingHook) {
if (!slackIncomingHook || !sendArguments) {
return;
}
const webhook = new IncomingWebhook(slackIncomingHook);
Expand All @@ -27,9 +27,9 @@ export async function notifyPrepared({
}

const sendArguments =
typeof prepared === 'string'
? prepared
: prepared({ appName, version, pullRequestUrl });
typeof prepared === 'function'
? prepared({ appName, version, pullRequestUrl })
: prepared;

await sendSlackMessage({
config,
Expand All @@ -51,9 +51,9 @@ export async function notifyReleaseStart({
}

const sendArguments =
typeof releaseStart === 'string'
? releaseStart
: releaseStart({ appName, version, latestCommitHash, latestCommitUrl });
typeof releaseStart === 'function'
? releaseStart({ appName, version, latestCommitHash, latestCommitUrl })
: releaseStart;

await sendSlackMessage({
config,
Expand All @@ -76,15 +76,15 @@ export async function notifyReleaseSuccess({
}

const sendArguments =
typeof releaseSuccess === 'string'
? releaseSuccess
: releaseSuccess({
typeof releaseSuccess === 'function'
? releaseSuccess({
appName,
version,
latestCommitHash,
latestCommitUrl,
repoURL,
});
})
: releaseSuccess;

await sendSlackMessage({
config,
Expand Down

0 comments on commit b0be6bf

Please sign in to comment.