ref(github): Include Sentry user attribution in created issue body - #124251
Open
parh0m2007 wants to merge 2 commits into
Open
ref(github): Include Sentry user attribution in created issue body#124251parh0m2007 wants to merge 2 commits into
parh0m2007 wants to merge 2 commits into
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.postnow passesrequest.usertoinstallation.create_issue.IssueBasicIntegration.create_issuegains an optionaluser: User | RpcUser | None = Nonekwarg (documented in the abstract docstring). Providers that don't care can ignore it — the kwarg is optional andNoneby default.GitHubIssuesSpec.create_issueappends\n\n*Created by {display name}*to the body when a user is provided.get_display_name()falls back toget_label(); both exist on the ORMUserandRpcUsermodels.sentry/rules/actions/integrations/create_ticket/utils.py) doesn't have an acting user and keeps callingcreate_issue(data)— no attribution line is added there, since the rule footer already links the automation.descriptionfrom the GitHub API response (which includes the attribution line) is stored on theExternalIssuerecord, 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.