Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
process events when the base is master (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
Puneeth-n committed Jan 27, 2022
1 parent e6e8572 commit 49729b4
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 11 deletions.
90 changes: 80 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ function apiGatewayResponse(

function processEvent(event: CheckSuiteEvent): boolean {
return (
event.check_suite.pull_requests.length > 0 &&
event.check_suite.pull_requests[0].base.ref === 'master' &&
event.action === 'completed' &&
event.check_suite.conclusion !== null &&
['success', 'neutral'].includes(event.check_suite.conclusion)
Expand Down Expand Up @@ -156,6 +158,7 @@ export async function handler(
event: APIGatewayProxyEventV2
): Promise<APIGatewayProxyResultV2> {
try {
log.info(event)
const secret = await parameters.get('webhookSecret')
validateGithubWebhookPayload(event, secret)
const checkSuiteEvent = JSON.parse(event.body as string) as CheckSuiteEvent
Expand Down

0 comments on commit 49729b4

Please sign in to comment.