From 9012f6b953e6c34a085161331b01be0c883f29d0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 22 Nov 2023 16:40:49 +0100 Subject: [PATCH] Fix GitHub App retrieval in webhooks.php --- routes/webhooks.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/routes/webhooks.php b/routes/webhooks.php index a2dbf5a1a..f59f8f681 100644 --- a/routes/webhooks.php +++ b/routes/webhooks.php @@ -317,7 +317,10 @@ Route::post('/source/github/events', function () { // Installation handled by setup redirect url. Repositories queried on-demand. return response('cool'); } - $github_app = GithubApp::where('app_id', $x_github_hook_installation_target_id)->firstOrFail(); + $github_app = GithubApp::where('app_id', $x_github_hook_installation_target_id)->first(); + if (is_null($github_app)) { + return response('Nothing to do. No GitHub App found.'); + } $webhook_secret = data_get($github_app, 'webhook_secret'); $hmac = hash_hmac('sha256', request()->getContent(), $webhook_secret);