Skip to content

Commit cc61daa

Browse files
committed
move up to original position
1 parent b976b8d commit cc61daa

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

src/sentry/seer/code_review/webhooks/pull_request.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -141,27 +141,6 @@ def handle_pull_request_event(
141141
)
142142
return
143143

144-
action_requires_trigger_permission = ACTIONS_REQUIRING_TRIGGER_CHECK.get(action)
145-
if action_requires_trigger_permission is not None and (
146-
org_code_review_settings is None
147-
or action_requires_trigger_permission not in org_code_review_settings.triggers
148-
):
149-
record_webhook_filtered(github_event, action_value, WebhookFilteredReason.TRIGGER_DISABLED)
150-
return
151-
152-
# If no triggers are configured for this repo, no pr_review was ever sent for it,
153-
# so there is nothing for Seer to process on close.
154-
if action == PullRequestAction.CLOSED and (
155-
org_code_review_settings is None or not org_code_review_settings.triggers
156-
):
157-
record_webhook_filtered(github_event, action_value, WebhookFilteredReason.TRIGGER_DISABLED)
158-
return
159-
160-
# Skip draft check for CLOSED actions to ensure Seer receives cleanup notifications
161-
# even if the PR was converted to draft before closing
162-
if action != PullRequestAction.CLOSED and pull_request.get("draft") is True:
163-
return
164-
165144
# Increment contributor actions now that the PR has cleared the code-review preflight check.
166145
# Gated on pr_was_created so a redelivered/concurrent "opened" webhook (PR row already exists)
167146
# does not double-count.
@@ -187,6 +166,27 @@ def handle_pull_request_event(
187166
},
188167
)
189168

169+
action_requires_trigger_permission = ACTIONS_REQUIRING_TRIGGER_CHECK.get(action)
170+
if action_requires_trigger_permission is not None and (
171+
org_code_review_settings is None
172+
or action_requires_trigger_permission not in org_code_review_settings.triggers
173+
):
174+
record_webhook_filtered(github_event, action_value, WebhookFilteredReason.TRIGGER_DISABLED)
175+
return
176+
177+
# If no triggers are configured for this repo, no pr_review was ever sent for it,
178+
# so there is nothing for Seer to process on close.
179+
if action == PullRequestAction.CLOSED and (
180+
org_code_review_settings is None or not org_code_review_settings.triggers
181+
):
182+
record_webhook_filtered(github_event, action_value, WebhookFilteredReason.TRIGGER_DISABLED)
183+
return
184+
185+
# Skip draft check for CLOSED actions to ensure Seer receives cleanup notifications
186+
# even if the PR was converted to draft before closing
187+
if action != PullRequestAction.CLOSED and pull_request.get("draft") is True:
188+
return
189+
190190
pr_number = pull_request.get("number")
191191
if pr_number and action in ACTIONS_ELIGIBLE_FOR_EYES_REACTION:
192192
# We don't ever need to delete :eyes: since we later add it back to the PR description idempotently.

0 commit comments

Comments
 (0)