webhook: send 200 for ping and installation wh
This commit is contained in:
parent
d1c0fe503e
commit
a97521aba2
@ -66,13 +66,19 @@ export async function configureGitHubApp(request, reply) {
|
||||
}
|
||||
export async function gitHubEvents(request: FastifyRequest<GitHubEvents>): Promise<any> {
|
||||
try {
|
||||
const allowedGithubEvents = ['push', 'pull_request'];
|
||||
const allowedGithubEvents = ['push', 'pull_request', 'ping', 'installation'];
|
||||
const allowedActions = ['opened', 'reopened', 'synchronize', 'closed'];
|
||||
const githubEvent = request.headers['x-github-event']?.toString().toLowerCase();
|
||||
const githubSignature = request.headers['x-hub-signature-256']?.toString().toLowerCase();
|
||||
if (!allowedGithubEvents.includes(githubEvent)) {
|
||||
throw { status: 500, message: 'Event not allowed.' }
|
||||
}
|
||||
if (githubEvent === 'ping') {
|
||||
return { pong: 'cool' }
|
||||
}
|
||||
if (githubEvent === 'installation') {
|
||||
return { status: 'cool' }
|
||||
}
|
||||
let projectId, branch;
|
||||
const body = request.body
|
||||
if (githubEvent === 'push') {
|
||||
|
Loading…
Reference in New Issue
Block a user