forked from codinasion/codinasion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.js
80 lines (68 loc) · 2.17 KB
/
action.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import core from "@actions/core";
import submitProgram from "./scripts/submitProgram.js";
import submitProgramCommentClose from "./scripts/submitProgramCommentClose.js";
import autoCreateIssue from "./scripts/autoCreateIssue.js";
import autoTrackIssue from "./scripts/autoTrackIssue.js";
import autoAssignIssue from "./scripts/autoAssignIssue.js";
// main action function
(async () => {
try {
console.log("Hii there !!!");
// get action default data
const OWNER = await core.getInput("OWNER");
const REPO = await core.getInput("REPO");
const TOKEN = await core.getInput("TOKEN");
const USERNAME = await core.getInput("USERNAME");
const ISSUE_NUMBER = await core.getInput("ISSUE_NUMBER");
const ISSUE_BODY = await core.getInput("ISSUE_BODY");
const ISSUE_TITLE = await core.getInput("ISSUE_TITLE");
const ISSUE_LABEL = await core.getInput("ISSUE_LABEL");
const SUBMIT_PROGRAM = await core.getInput("SUBMIT_PROGRAM");
const SUBMIT_PROGRAM_COMMENT_CLOSE = await core.getInput(
"SUBMIT_PROGRAM_COMMENT_CLOSE"
);
const AUTO_CREATE_ISSUE = await core.getInput("AUTO_CREATE_ISSUE");
const AUTO_TRACK_ISSUE = await core.getInput("AUTO_TRACK_ISSUE");
const AUTO_ASSIGN_ISSUE = await core.getInput("AUTO_ASSIGN_ISSUE");
if (SUBMIT_PROGRAM === "true") {
await submitProgram(
OWNER,
REPO,
TOKEN,
USERNAME,
ISSUE_NUMBER,
ISSUE_TITLE,
ISSUE_BODY,
ISSUE_LABEL
);
}
if (SUBMIT_PROGRAM_COMMENT_CLOSE === "true") {
await submitProgramCommentClose(
OWNER,
REPO,
TOKEN,
ISSUE_NUMBER,
ISSUE_LABEL
);
}
if (AUTO_CREATE_ISSUE === "true") {
await autoCreateIssue(OWNER, REPO, TOKEN);
}
if (AUTO_TRACK_ISSUE === "true") {
await autoTrackIssue(
OWNER,
REPO,
TOKEN,
ISSUE_NUMBER,
ISSUE_TITLE,
ISSUE_BODY
);
}
if (AUTO_ASSIGN_ISSUE === "true") {
await autoAssignIssue(OWNER, REPO, TOKEN, ISSUE_NUMBER, USERNAME);
}
// end of main function
} catch (e) {
core.setFailed(`Action failed with "${e.message}"`);
}
})();