Skip to content

Commit

Permalink
Add handleIfRightRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
timonson committed Mar 19, 2024
1 parent 267a9f1 commit be9705f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions middlewares/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@ export function addWebhookPayloadToState(
}
};
}

export function handleIfRightRepository(middleware: any, repoName: string) {
return async <C extends Context<WebhooksState>>(ctx: C): Promise<C> => {
if (ctx.state.webhookPayload?.repository?.name === repoName) {
return await middleware(ctx);
} else {
return ctx;
}
};
}

0 comments on commit be9705f

Please sign in to comment.