fix(webhooks): clean up closed Bitbucket PRs after destination branch changes (#12008)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
johandenhollander
2026-10-15 22:55:00 +02:00
committed by GitHub
co-authored by Claude Opus 5.5
parent d0dff5b129
commit e02f932a34
2 changed files with 110 additions and 1 deletions
+5 -1
View File
@@ -84,7 +84,11 @@ class Bitbucket extends Controller
$failure_key = $this->manualWebhookFailureRateLimitKey($request, 'bitbucket', $full_name, $branch);
// A redelivery of the same signed payload is one guess.
$failure_attempt = $this->manualWebhookSignedPayloadAttempt($request, $x_bitbucket_token);
$applications = $this->manualWebhookApplications(Application::query()->where('git_branch', $branch), $full_name);
$applications = Application::query();
if ($x_bitbucket_event !== 'pullrequest:rejected' && $x_bitbucket_event !== 'pullrequest:fulfilled') {
$applications->where('git_branch', $branch);
}
$applications = $this->manualWebhookApplications($applications, $full_name);
if ($applications->isEmpty()) {
return $this->unauthenticatedManualWebhookResponse($failure_key, $failure_attempt);
}