-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
41 lines (34 loc) · 837 Bytes
/
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
const core = require("@actions/core");
const github = require("@actions/github");
import { run as runPush } from "./src/push";
import { run as runPullRequest } from "./src/pull-request";
import { run as runIssues } from "./src/issues";
async function run() {
try {
const eventName = github.context.eventName;
core.debug(`Event Name: ${eventName}`);
switch (eventName) {
case "push": {
await runPush();
break;
}
case "pull_request": {
await runPullRequest();
break;
}
case "issues": {
await runIssues();
break;
}
default: {
core.info(`Skipping operations on ${eventName} event`);
break;
}
}
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message);
}
}
}
run();