Skip to content

Commit

Permalink
chore(gha): handle both pull_request and issue_comment triggered events
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed May 4, 2024
1 parent 72ad1aa commit b4c740a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/broken-link-checker/src/index.ts
Expand Up @@ -80,8 +80,17 @@ const postComment = async (outputMd: string) => {
const { context, getOctokit } = github
const octokit = getOctokit(process.env.GITHUB_TOKEN!)
const { owner, repo } = context.repo
let prNumber

// Handle various trigger events
if (context.payload.pull_request) {
// Triggered by `pull_request`
prNumber = context.payload.pull_request?.number
} else if (context.payload.issue) {
// Triggered by `issue_comment`
prNumber = context.payload?.issue?.number
}

const prNumber = context.payload?.issue?.number
if (!prNumber) {
setFailed("Count not find PR Number")
return ""
Expand Down

0 comments on commit b4c740a

Please sign in to comment.