Skip to content

Commit 9b46f2b

Browse files
chromygeorge-sentry
authored andcommitted
feat(autofix): Add copy PR URL button to v3 pull request card (#112356)
Add a copy-to-clipboard button next to each "View PR" link in the autofix v3 `PullRequestsCard` component. This lets users quickly copy the PR URL without having to navigate to the PR and copy from the browser address bar. Before: <img width="1504" height="286" alt="CleanShot 2026-04-07 at 14 39 10@2x" src="https://github.com/user-attachments/assets/4048e271-faa2-49ba-a3da-77d1dc7c9e8e" /> After: <img width="1538" height="274" alt="CleanShot 2026-04-07 at 14 46 21@2x" src="https://github.com/user-attachments/assets/d8da7ead-0ffd-4b9f-9b84-f6f5602d4d8a" /> https://github.com/user-attachments/assets/c87ae62f-ac7e-4df4-8982-e3985d783ce4 Agent transcript: https://claudescope.sentry.dev/share/0s3dF7X9zMvJqcU4xHgQjL4UN_S9Ay92eXE7oFPbOYA
1 parent 9512a84 commit 9b46f2b

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

static/app/components/events/autofix/v3/autofixCards.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
} from 'sentry/components/events/autofix/useExplorerAutofix';
2626
import {LoadingIndicator} from 'sentry/components/loadingIndicator';
2727
import {TimeSince} from 'sentry/components/timeSince';
28-
import {IconRefresh} from 'sentry/icons';
28+
import {IconCopy, IconRefresh} from 'sentry/icons';
2929
import {IconBot} from 'sentry/icons/iconBot';
3030
import {IconBug} from 'sentry/icons/iconBug';
3131
import {IconCode} from 'sentry/icons/iconCode';
@@ -34,6 +34,7 @@ import {IconOpen} from 'sentry/icons/iconOpen';
3434
import {IconPullRequest} from 'sentry/icons/iconPullRequest';
3535
import {t, tct, tn} from 'sentry/locale';
3636
import {defined} from 'sentry/utils';
37+
import {useCopyToClipboard} from 'sentry/utils/useCopyToClipboard';
3738
import {FileDiffViewer} from 'sentry/views/seerExplorer/fileDiffViewer';
3839

3940
interface AutofixCardProps {
@@ -259,6 +260,7 @@ export function PullRequestsCard({section}: AutofixCardProps) {
259260
const sectionArtifact = getAutofixArtifactFromSection(section);
260261
return isPullRequestsArtifact(sectionArtifact) ? sectionArtifact : null;
261262
}, [section]);
263+
const {copy} = useCopyToClipboard();
262264

263265
return (
264266
<ArtifactCard icon={<IconPullRequest />} title={t('Pull Requests')}>
@@ -277,14 +279,22 @@ export function PullRequestsCard({section}: AutofixCardProps) {
277279
pullRequest.pr_number
278280
) {
279281
return (
280-
<LinkButton
281-
key={pullRequest.repo_name}
282-
external
283-
href={pullRequest.pr_url}
284-
priority="primary"
285-
>
286-
{t('View %s#%s', pullRequest.repo_name, pullRequest.pr_number)}
287-
</LinkButton>
282+
<Flex key={pullRequest.repo_name} gap="xs" align="center">
283+
<LinkButton external href={pullRequest.pr_url} priority="primary">
284+
{t('View %s#%s', pullRequest.repo_name, pullRequest.pr_number)}
285+
</LinkButton>
286+
<Button
287+
priority="primary"
288+
icon={<IconCopy size="xs" />}
289+
aria-label={t('Copy PR URL')}
290+
tooltipProps={{title: t('Copy PR URL')}}
291+
onClick={() =>
292+
copy(pullRequest.pr_url!, {
293+
successMessage: t('PR URL copied to clipboard.'),
294+
})
295+
}
296+
/>
297+
</Flex>
288298
);
289299
}
290300

0 commit comments

Comments
 (0)