mirror of
https://github.com/mshick/add-pr-comment.git
synced 2026-01-01 14:49:44 +11:00
handle non-pr payloads
This commit is contained in:
parent
40dc605d1f
commit
0f7c123bc8
1 changed files with 9 additions and 4 deletions
13
index.js
13
index.js
|
|
@ -11,12 +11,17 @@ async function run() {
|
||||||
core.debug(`input allow-repeats: ${allowRepeats}`);
|
core.debug(`input allow-repeats: ${allowRepeats}`);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
payload: {
|
payload: { pull_request: pullRequest, repository }
|
||||||
pull_request: { number: issueNumber },
|
|
||||||
repository: { full_name: repoFullName }
|
|
||||||
}
|
|
||||||
} = github.context;
|
} = github.context;
|
||||||
|
|
||||||
|
if (!pullRequest) {
|
||||||
|
core.error("this action only works on pull_request events");
|
||||||
|
core.setOutput("comment-created", "false");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { number: issueNumber } = pullRequest;
|
||||||
|
const { full_name: repoFullName } = repository;
|
||||||
const [owner, repo] = repoFullName.split("/");
|
const [owner, repo] = repoFullName.split("/");
|
||||||
|
|
||||||
const octokit = new github.GitHub(repoToken);
|
const octokit = new github.GitHub(repoToken);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue