-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (32 loc) · 892 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
const core = require("@actions/core");
const gitHub = require("@actions/github");
function run() {
try {
const [
gitHubRepoOwner,
gitHubRepoName,
] = process.env.GITHUB_REPOSITORY.split("/");
const gitHubSha = process.env.GITHUB_SHA;
const gitHubToken = core.getInput("token", { required: true });
const checkName = core.getInput("name", { required: true });
const status = core.getInput("status") || "completed";
const conclusion = core.getInput("conclusion") || "success";
const octokit = new gitHub.GitHub(gitHubToken);
octokit.checks.create({
owner: gitHubRepoOwner,
repo: gitHubRepoName,
name: checkName,
head_sha: gitHubSha,
status,
conclusion,
output: {
title: checkName,
summary: `${checkName}: Check created for ${gitHubSha}`,
},
});
} catch (error) {
core.error(error);
core.setFailed(error.message);
}
}
run();