Skip to content

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

Open
kukanggg89 wants to merge 3 commits into
getsentry:masterfrom
kukanggg89:github-issue-user-attribution-90806
Open

kukanggg89 wants to merge 3 commits into
getsentry:masterfrom
kukanggg89:github-issue-user-attribution-90806

Conversation

@kukanggg89

Copy link
Copy Markdown

Issues created from Sentry through the GitHub integration now end with a *Created by Sentry on behalf of {name}* line, so anyone reading the issue on GitHub can see which Sentry user created it and who to ask about it.

This picks up #127187, which the stale bot closed twice while it waited for review. Two points from that review are handled here. The line uses the Sentry user's name only, with no fallback to email, so an email address never ends up in a public issue body. The wording follows the suggestion there, "Created by Sentry on behalf of {user}". No line is added when the user has no name set, or when the issue is created automatically by a rule, since that path has no acting user.

The change itself is small. GroupIntegrationDetailsEndpoint.post passes the signed-in user through to installation.create_issue, IssueBasicIntegration.create_issue takes an optional user argument, and GitHubIssuesSpec.create_issue appends the line to the body when a name is present. Other providers take the same argument through **kwargs and ignore it, so only GitHub issues get the line for now, matching the scope of the issue.

Tests: three new cases in tests/sentry/integrations/github/test_issues.py. One checks the posted GitHub payload carries the attribution line for a named user, one checks the body is untouched when no user is passed, and one checks a user with no name set gets no line either. The test suite was not run locally; the new tests rely on the repo CI to run.

Fixes #90806

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

When a Sentry user creates a GitHub issue from the issue detail page, the created issue now ends with a "*Created by Sentry on behalf of {name}*" line, so readers on GitHub know who to follow up with. The name is used as-is, with no email fallback, so nothing private leaks onto a public repository; no line is added when the user has no name set or when the issue is created automatically by a rule.

Fixes getsentry#90806

Assisted-by: Muse
@kukanggg89
kukanggg89 requested review from a team as code owners December 3, 2026 02:45
@vercel

vercel Bot commented Dec 3, 2026

Copy link
Copy Markdown

@kukanggg89 is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 3, 2026
@bruno-garcia

Copy link
Copy Markdown
Member

@giovanni-guidini the other PR had a comment but no reply:

#127187 (review)

I'd say it's fine if we do this for GitHub only unless there's a better place to make this more at a platform level

The named `user` parameter on the abstract `create_issue` broke
mypy: the six other provider overrides only declare
`(data, **kwargs)`, so the base signature no longer matched
them. Drop the parameter from the base class again and read
the user out of `**kwargs` in the GitHub override instead;
the endpoint call passes it as a keyword argument either way.

Also drop the stray blank lines at the end of the touched
files that `ruff format` flagged.

Assisted-by: Muse
pre-commit lint failed on the previous head because `ruff
format` wanted one more blank line between two test
methods in tests/sentry/integrations/github/test_issues.py.
Applied the `ruff format` output verbatim; no behavior
change.

Assisted-by: Muse

This branch has not been deployed

No deployments
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

2 participants