-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.js
47 lines (40 loc) · 1.35 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const debug = require('debug')('@intuit/semantic-release-slack');
const verify = require('./src/verify');
const successCall = require('./src/success');
const failCall = require('./src/fail');
let verified;
/**
* Called by semantic-release during the verification step
* @param {*} pluginConfig The semantic-release plugin config
* @param {*} context The context provided by semantic-release
*/
async function verifyConditions(pluginConfig, context) {
await verify(pluginConfig, context);
verified = true;
}
/**
* Called by semantic-release during the success step
* @param {*} pluginConfig The semantic-release plugin config
* @param {*} context The context provided by semantic-release
*/
async function success(pluginConfig, context) {
debug(`Plugin Config for success: ${JSON.stringify(pluginConfig, null, 2)}`);
if (!verified) {
await verify(pluginConfig, context);
verified = true;
}
await successCall(pluginConfig, context);
}
/**
* Called by semantic-release during the fail step
* @param {*} pluginConfig The semantic-release plugin config
* @param {*} context The context provided by semantic-release
*/
async function fail(pluginConfig, context) {
if (!verified) {
await verify(pluginConfig, context);
verified = true;
}
await failCall(pluginConfig, context);
}
module.exports = { verifyConditions, success, fail };