build for normal issue support, and deps

This commit is contained in:
Michael Shick 2020-08-11 15:42:11 -07:00
parent 01ba04de6a
commit 07f690343c
No known key found for this signature in database
GPG key ID: ADF5BC9704BB4A61
4 changed files with 2616 additions and 687 deletions

View file

@ -67,7 +67,7 @@ const run = async () => {
if (!repoToken) {
throw new Error('no github token provided, set one with the repo-token input or GITHUB_TOKEN env variable');
}
const { payload: { pull_request: pullRequest, repository }, sha: commitSha, } = github.context;
const { payload: { pull_request: pullRequest, issue, repository }, sha: commitSha, } = github.context;
if (!repository) {
core.info('unable to determine repository from request type');
core.setOutput('comment-created', 'false');
@ -76,7 +76,10 @@ const run = async () => {
const { full_name: repoFullName } = repository;
const [owner, repo] = repoFullName.split('/');
let issueNumber;
if (pullRequest && pullRequest.number) {
if (issue && issue.number) {
issueNumber = issue.number;
}
else if (pullRequest && pullRequest.number) {
issueNumber = pullRequest.number;
}
else {
@ -85,7 +88,7 @@ const run = async () => {
issueNumber = commitPullsList && getIssueNumberFromCommitPullsList(commitPullsList);
}
if (!issueNumber) {
core.info('this action only works on pull_request events or other commits associated with a pull');
core.info('this action only works on issues and pull_request events or other commits associated with a pull');
core.setOutput('comment-created', 'false');
return;
}