Skip to content

Commit b4c740a

Browse files
committed
chore(gha): handle both pull_request and issue_comment triggered events
1 parent 72ad1aa commit b4c740a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/broken-link-checker/src/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,17 @@ const postComment = async (outputMd: string) => {
8080
const { context, getOctokit } = github
8181
const octokit = getOctokit(process.env.GITHUB_TOKEN!)
8282
const { owner, repo } = context.repo
83+
let prNumber
84+
85+
// Handle various trigger events
86+
if (context.payload.pull_request) {
87+
// Triggered by `pull_request`
88+
prNumber = context.payload.pull_request?.number
89+
} else if (context.payload.issue) {
90+
// Triggered by `issue_comment`
91+
prNumber = context.payload?.issue?.number
92+
}
8393

84-
const prNumber = context.payload?.issue?.number
8594
if (!prNumber) {
8695
setFailed("Count not find PR Number")
8796
return ""

0 commit comments

Comments
 (0)