-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (28 loc) · 739 Bytes
/
index.js
File metadata and controls
31 lines (28 loc) · 739 Bytes
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
const core = require("@actions/core");
const github = require("@actions/github");
try {
const { context } = github;
const githubToken = core.getInput("GITHUB_TOKEN");
const body = core.getInput("body");
if (context.payload.pull_request == null) {
core.setFailed("No pull request found");
return;
}
if (!githubToken) {
core.setFailed("GITHUB_TOKEN input is required");
return;
}
if (!body) {
core.setFailed("body input is required");
return;
}
const { number: prNumber } = context.payload.pull_request;
const octokit = new github.GitHub(githubToken);
octokit.pulls.update({
...context.repo,
pull_number: prNumber,
body
});
} catch (error) {
core.setFailed(error.message);
}