mirror of
https://github.com/mshick/add-pr-comment.git
synced 2026-01-01 06:29:49 +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 {
|
const {
|
||||||
payload: {pull_request: pullRequest, repository},
|
payload: {pull_request: pullRequest, issue, repository},
|
||||||
sha: commitSha,
|
sha: commitSha,
|
||||||
} = github.context
|
} = github.context
|
||||||
|
|
||||||
|
|
@ -121,12 +121,14 @@ const run = async (): Promise<void> => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const {full_name: repoFullName} = repository!
|
const {full_name: repoFullName} = repository
|
||||||
const [owner, repo] = repoFullName!.split('/')
|
const [owner, repo] = repoFullName!.split('/')
|
||||||
|
|
||||||
let issueNumber
|
let issueNumber
|
||||||
|
|
||||||
if (pullRequest && pullRequest.number) {
|
if (issue && issue.number) {
|
||||||
|
issueNumber = issue.number
|
||||||
|
} else if (pullRequest && pullRequest.number) {
|
||||||
issueNumber = pullRequest.number
|
issueNumber = pullRequest.number
|
||||||
} else {
|
} else {
|
||||||
// If this is not a pull request, attempt to find a PR matching the sha
|
// 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) {
|
if (!issueNumber) {
|
||||||
core.info(
|
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')
|
core.setOutput('comment-created', 'false')
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue