Skip to content

ref(github): Include Sentry user attribution in created issue body - #124251

Open
parh0m2007 wants to merge 2 commits into
getsentry:masterfrom
parh0m2007:feat/github-issue-user-attribution
Open

ref(github): Include Sentry user attribution in created issue body#124251
parh0m2007 wants to merge 2 commits into
getsentry:masterfrom
parh0m2007:feat/github-issue-user-attribution

Conversation

@parh0m2007

Copy link
Copy Markdown

Summary

When a Sentry user creates a GitHub issue through the issue integration (via the issue detail page), the created GitHub issue body now ends with a *Created by {display name}* line so that external readers know which Sentry user created it and who to follow up with. Fixes #90806.

Implementation

  • GroupIntegrationDetailsEndpoint.post now passes request.user to installation.create_issue.
  • IssueBasicIntegration.create_issue gains an optional user: User | RpcUser | None = None kwarg (documented in the abstract docstring). Providers that don't care can ignore it — the kwarg is optional and None by default.
  • GitHubIssuesSpec.create_issue appends \n\n*Created by {display name}* to the body when a user is provided. get_display_name() falls back to get_label(); both exist on the ORM User and RpcUser models.
  • Rule-triggered (automated) issue creation is unchanged: the ticket action path (sentry/rules/actions/integrations/create_ticket/utils.py) doesn't have an acting user and keeps calling create_issue(data) — no attribution line is added there, since the rule footer already links the automation.
  • The returned description from the GitHub API response (which includes the attribution line) is stored on the ExternalIssue record, consistent with how a manually-typed body is stored today.

Tests

  • test_create_issue_with_user_attribution — verifies the POSTed GitHub payload body contains the *Created by ...* suffix.
  • test_create_issue_without_user_no_attribution — verifies rule-triggered creation leaves the body untouched.

When a Sentry user creates a GitHub issue through the issue
integrations, append a "*Created by {display name}*" line to the
issue body so external readers know who to follow up with.

The new optional `user` kwarg on `create_issue` is threaded from
the GroupIntegrationDetailsEndpoint POST handler. Rule-triggered
creation passes no user and leaves the body unchanged.
@parh0m2007
parh0m2007 requested review from a team as code owners September 13, 2026 13:06
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 13, 2026
Add the optional `user` kwarg to the remaining create_issue
overrides (example, jira, jira_server, bitbucket, gitlab, vsts)
so mypy accepts them as compatible with the updated abstract
signature, and apply ruff formatting.
@parh0m2007
parh0m2007 requested a review from a team as a code owner September 13, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Github: Include Sentry username in issue body created by issue integrations

1 participant