forked from codinasion/codinasion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.js
136 lines (112 loc) · 3.41 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import core from "@actions/core";
import submitProgram from "./scripts/submitProgram.js";
import submitProgramCommentClose from "./scripts/submitProgramCommentClose.js";
import submitDsa from "./scripts/submitDsa.js";
import submitDsaCommentClose from "./scripts/submitDsaCommentClose.js";
import autoCreateIssue from "./scripts/autoCreateIssue.js";
import autoCreateDsaIssue from "./scripts/autoCreateDsaIssue.js";
import autoTrackIssue from "./scripts/autoTrackIssue.js";
import autoTrackDsaIssue from "./scripts/autoTrackDsaIssue.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 SUBMIT_DSA = await core.getInput("SUBMIT_DSA");
const SUBMIT_DSA_COMMENT_CLOSE = await core.getInput(
"SUBMIT_DSA_COMMENT_CLOSE"
);
const AUTO_CREATE_ISSUE = await core.getInput("AUTO_CREATE_ISSUE");
const AUTO_CREATE_DSA_ISSUE = await core.getInput("AUTO_CREATE_DSA_ISSUE");
const AUTO_TRACK_ISSUE = await core.getInput("AUTO_TRACK_ISSUE");
const AUTO_TRACK_DSA_ISSUE = await core.getInput("AUTO_TRACK_DSA_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 (SUBMIT_DSA === "true") {
await submitDsa(
OWNER,
REPO,
TOKEN,
USERNAME,
ISSUE_NUMBER,
ISSUE_TITLE,
ISSUE_BODY,
ISSUE_LABEL
);
}
if (SUBMIT_DSA_COMMENT_CLOSE === "true") {
await submitDsaCommentClose(
OWNER,
REPO,
TOKEN,
ISSUE_NUMBER,
ISSUE_LABEL
);
}
if (AUTO_CREATE_ISSUE === "true") {
await autoCreateIssue(OWNER, REPO, TOKEN);
}
if (AUTO_CREATE_DSA_ISSUE === "true") {
await autoCreateDsaIssue(OWNER, REPO, TOKEN);
}
if (AUTO_TRACK_ISSUE === "true") {
await autoTrackIssue(
OWNER,
REPO,
TOKEN,
ISSUE_NUMBER,
ISSUE_TITLE,
ISSUE_BODY
);
}
if (AUTO_TRACK_DSA_ISSUE === "true") {
await autoTrackDsaIssue(
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}"`);
}
})();