An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: pr webhook
Andras Bacsai8645d954ddb0
diff --git a/apps/api/src/routes/webhooks/github/handlers.ts b/apps/api/src/routes/webhooks/github/handlers.tsindex 3f691d7e81..d8b4e7be8d 100644--- a/apps/api/src/routes/webhooks/github/handlers.ts+++ b/apps/api/src/routes/webhooks/github/handlers.ts@@ -75,16 +75,14 @@ export async function gitHubEvents(request: FastifyRequest<GitHubEvents>): Promiif (!allowedGithubEvents.includes(githubEvent)) {throw { status: 500, message: 'Event not allowed.' }}- let repository, projectId, branch;+ let projectId, branch;const body = request.bodyif (githubEvent === 'push') {- repository = body.repository;- projectId = repository.id;+ projectId = body.repository.id;branch = body.ref.includes('/') ? body.ref.split('/')[2] : body.ref;} else if (githubEvent === 'pull_request') {- repository = body.pull_request.head.repo;- projectId = repository.id;- branch = body.pull_request.head.ref.includes('/') ? body.pull_request.head.ref.split('/')[2] : body.pull_request.head.ref;+ projectId = body.pull_request.base.repo.id;+ branch = body.pull_request.base.ref.includes('/') ? body.pull_request.base.ref.split('/')[2] : body.pull_request.base.ref;}if (!projectId || !branch) {throw { status: 500, message: 'Cannot parse projectId or branch from the webhook?!' }@@ -156,7 +154,7 @@ export async function gitHubEvents(request: FastifyRequest<GitHubEvents>): Promi} else if (githubEvent === 'pull_request') {const pullmergeRequestId = body.number;const pullmergeRequestAction = body.action;- const sourceBranch = body.pull_request.head.ref;+ const sourceBranch = body.pull_request.base.ref.includes('/') ? body.pull_request.base.ref.split('/')[2] : body.pull_request.base.ref;if (!allowedActions.includes(pullmergeRequestAction)) {throw { status: 500, message: 'Action not allowed.' }}diff --git a/apps/api/src/routes/webhooks/github/types.ts b/apps/api/src/routes/webhooks/github/types.tsindex c7502ec6d8..a8f5d3817d 100644--- a/apps/api/src/routes/webhooks/github/types.ts+++ b/apps/api/src/routes/webhooks/github/types.ts@@ -8,12 +8,16 @@ export interface GitHubEvents {Body: {number: string,action: string,- repository: string,+ repository: {+ id: string,+ },ref: string,pull_request: {- head: {+ base: {ref: string,- repo: string+ repo: {+ id: string,+ }}}}