mirror of
https://github.com/mshick/add-pr-comment.git
synced 2025-12-31 14:20:32 +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}`);
|
||||
|
||||
const {
|
||||
payload: {
|
||||
pull_request: { number: issueNumber },
|
||||
repository: { full_name: repoFullName }
|
||||
}
|
||||
payload: { pull_request: pullRequest, repository }
|
||||
} = 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 octokit = new github.GitHub(repoToken);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue