Skip to content

Commit

Permalink
fix: Actually Call ProjectSync
Browse files Browse the repository at this point in the history
  • Loading branch information
noahonyejese committed Jan 8, 2025
1 parent b5e6126 commit d42ea56
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/api/github/events/projects/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { projectSync } from '@/server/github/syncs';
import { verifyGitHubRequest } from '@/server/security';
import { createError } from '@/utils/error-handling';
import {
Expand All @@ -10,6 +11,7 @@ import {
PullRequestEvent,
PullRequestReviewEvent,
PushEvent,
Repository,
RepositoryEvent,
WebhookEventMap,
WebhookEventName,
Expand All @@ -30,6 +32,10 @@ export const POST = async (req: NextRequest) => {
const body = JSON.parse(rawBody) as WebhookEventMap[WebhookEventName];
const event = req.headers.get('x-github-event') as WebhookEventName;

if (event !== 'ping' && 'repository' in body) {
await projectSync(body.repository as Repository);
}

switch (event) {
case 'ping': {
const pingEvent = body as PingEvent;
Expand Down

0 comments on commit d42ea56

Please sign in to comment.