-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
38 lines (30 loc) · 991 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
const core = require("@actions/core");
const github = require("@actions/github");
async function run() {
try {
const repoToken = core.getInput("repoToken");
const eventName = core.getInput("eventName");
const payload = github.context.payload;
console.log(`### Event: ${eventName}`);
console.log(`### The event payload: `);
console.log(`${JSON.stringify(payload)}`);
const owner = payload.repository.owner.login;
const repoName = payload.repository.name;
if (eventName === "issue_comment") {
if (payload.comment.body === "LGTM") {
console.log(`--> New comment (ID): ${payload.comment.id}`);
const pullNumber = payload.issue.number;
}
}
if (eventName === "status") {
console.log(`--> New status for commit (SHA): ${payload.sha}`);
}
if (eventName === "push") {
console.log(`--> New commit (SHA): ${payload.after}`);
}
}
catch (error) {
core.setFailed(error.message);
}
}
run()