Skip to content

Commit

Permalink
Update pr logic
Browse files Browse the repository at this point in the history
Signed-off-by: Brett Logan <lindluni@github.com>
  • Loading branch information
lindluni committed Mar 10, 2024
1 parent fc4ebbb commit b8e9993
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,19 @@ octokit.webhooks.on('issue_comment.created', async ({octokit, payload}) => {
const issueNumber = payload.issue.number
const actor = payload.comment.user.login
const metadata = `${actor}:${owner}:${repo}:${issueNumber}:${payload.comment.id}`
if (payload.pull_request == null) {
console.log(`[${metadata}] Not a pull request comment`)
return
}

console.log(`[${metadata}] Received command: '${body}' from ${actor}`)
if (body.startsWith('/actions-bot')) {
console.log(`[${metadata}] Processing command`)
if (body.includes('rerun-required-workflows')) {
console.log(`[${metadata}] Processing rerun-required-workflows`)
await processRerunRequiredWorkflows(octokit, body, owner, repo, issueNumber, actor, metadata)
} else {
console.log(`[${metadata}] Unknown command`)
if (payload.issue.pull_request) {
console.log(`[${metadata}] Received command: '${body}' from ${actor}`)
if (body.startsWith('/actions-bot')) {
console.log(`[${metadata}] Processing command`)
if (body.includes('rerun-required-workflows')) {
console.log(`[${metadata}] Processing rerun-required-workflows`)
await processRerunRequiredWorkflows(octokit, body, owner, repo, issueNumber, actor, metadata)
} else {
console.log(`[${metadata}] Unknown command`)
}
}
} else {
console.log(`[${metadata}] Issue is not a pull request`)
}
} catch (e) {
console.log(`Error: ${e.message}`)
Expand Down

0 comments on commit b8e9993

Please sign in to comment.