mirror of
https://github.com/mshick/add-pr-comment.git
synced 2025-12-31 22:29:45 +11:00
add support for normal issues
This commit is contained in:
parent
e2229d7f55
commit
01ba04de6a
1 changed files with 6 additions and 4 deletions
10
src/main.ts
10
src/main.ts
|
|
@ -111,7 +111,7 @@ const run = async (): Promise<void> => {
|
|||
}
|
||||
|
||||
const {
|
||||
payload: {pull_request: pullRequest, repository},
|
||||
payload: {pull_request: pullRequest, issue, repository},
|
||||
sha: commitSha,
|
||||
} = github.context
|
||||
|
||||
|
|
@ -121,12 +121,14 @@ const run = async (): Promise<void> => {
|
|||
return
|
||||
}
|
||||
|
||||
const {full_name: repoFullName} = repository!
|
||||
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 {
|
||||
// If this is not a pull request, attempt to find a PR matching the sha
|
||||
|
|
@ -136,7 +138,7 @@ const run = async (): Promise<void> => {
|
|||
|
||||
if (!issueNumber) {
|
||||
core.info(
|
||||
'this action only works on pull_request events or other commits associated with a pull'
|
||||
'this action only works on issues and pull_request events or other commits associated with a pull'
|
||||
)
|
||||
core.setOutput('comment-created', 'false')
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue