Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit f5129f8

Browse files
committed
Github: trim /files, /commits, etc. from the end of PR URLs
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
1 parent 2fd66c1 commit f5129f8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/handler/github/githubPRHandler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ import { renderIcon } from '../../common/icon';
33
import { openDevEnv } from '../../utils/utils';
44
import { Handler } from '../handler';
55

6+
const getPRURL = () =>
7+
document.location.href.replace('/files', '').replace('/commits', '').replace('/checks', '').replace('/files', '');
8+
69
const renderButton = () => {
710
const icon = renderIcon();
811
const ourButton = document.createElement('button');
912
ourButton.id = BUTTON_ID;
1013
ourButton.title = BUTTON_TITLE;
1114
ourButton.textContent = BUTTON_TEXT;
1215
ourButton.className = `${DEVENVS_BUTTON_STYLE} ${GITHUB_BUTTON_STYLE} btn btn-sm`;
13-
ourButton.addEventListener('click', openDevEnv(document.location.href));
16+
ourButton.addEventListener('click', openDevEnv(getPRURL()));
1417
ourButton.appendChild(icon);
1518

1619
return ourButton;

0 commit comments

Comments
 (0)