-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.js
More file actions
28 lines (21 loc) · 776 Bytes
/
run.js
File metadata and controls
28 lines (21 loc) · 776 Bytes
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
const core = require('@actions/core');
const configHelper = require('./lib/configHelper');
const manager = require('./lib/workflowManager');
async function run() {
try {
const INCOMING_WEBHOOK_URL = configHelper.getConfig('slackWebhook');
const getMessages = require('./lib/api');
const { constructedMessage, haveCommits } = await getMessages();
const createMessage = require('./lib/createMessage');
const message = createMessage(constructedMessage);
const sendMessage = require('./lib/sendMessage');
const json = await sendMessage(message, INCOMING_WEBHOOK_URL);
if (!haveCommits) {
manager.cancel();
}
core.setOutput('response', json);
} catch (error) {
core.setFailed(error.message);
}
}
module.exports = run;