Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/scripts/sentry_to_github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,18 @@ def create_github_issue(sentry_issue: dict) -> None:


def main() -> int:
issues = get_new_sentry_issues()
try:
issues = get_new_sentry_issues()
except requests.exceptions.HTTPError as exc:
status = exc.response.status_code if exc.response is not None else None
if status in (401, 403):
print(
f"::warning::Sentry API request failed with HTTP {status}. "
"This usually means SENTRY_AUTH_TOKEN is missing the 'event:read' "
"and/or 'project:read' scopes required to list issues."
)
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
raise
Comment on lines +98 to +104

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): For HTTP 401 or 403 responses, main prints the explanatory message and then reaches the unconditional raise, so the HTTPError remains unhandled and the sync workflow still exits nonzero instead of returning 0.

Triggers: When the Sentry issues endpoint returns HTTP 401 or 403.

Suggested fix: Return 0 inside the if status in (401, 403): branch, before the unconditional raise.

Suggested change
if status in (401, 403):
print(
f"⚠️ Sentry API request failed with HTTP {status}. "
"This usually means SENTRY_AUTH_TOKEN is missing the 'event:read' "
"and/or 'project:read' scopes required to list issues."
)
raise
if status in (401, 403):
print(
f"⚠️ Sentry API request failed with HTTP {status}. "
"This usually means SENTRY_AUTH_TOKEN is missing the 'event:read' "
"and/or 'project:read' scopes required to list issues."
)
return 0
raise


print(f"Found {len(issues)} unresolved Sentry issue(s) in the last {STATS_PERIOD}.")

for issue in issues:
Expand Down
Loading