Skip to content

Commit 40aba09

Browse files
saphidclaude
andauthored
fix(github): Enterprise Server pull request URLs can be pasted to check out (#29892)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d7ee7b3 commit 40aba09

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎packages/client-runtime/src/pullRequestLinkInput.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ describe("parsePullRequestReference", () => {
173173
expect(parsePullRequestReference(url)).toBe(url);
174174
});
175175

176+
it.each([
177+
"https://github.acme.test/acme/web/pull/42",
178+
"https://git.corp.example/acme/web/pull/42/files?diff=split",
179+
])("accepts GitHub Enterprise Server pull request URL %s", (url) => {
180+
expect(parsePullRequestReference(url)).toBe(url);
181+
expect(parsePullRequestReference(`gh pr checkout ${url}`)).toBe(url);
182+
});
183+
176184
it("accepts gh pr checkout commands with raw numbers", () => {
177185
expect(parsePullRequestReference("gh pr checkout 42")).toBe("42");
178186
});

‎packages/source-control-github/src/shared/definition.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { gitHubReferenceAutolinks } from "./referenceAutolinks.ts";
1919

2020
const CHECKOUT_COMMAND = /^gh\s+pr\s+checkout\s+(.+)$/i;
2121
const CHANGE_REQUEST_REFERENCE =
22-
/^https:\/\/github\.com\/[^/\s]+\/[^/\s]+\/pull\/(\d+)(?:[/?#].*)?$/i;
22+
/^https?:\/\/[^/?#\s]+\/[^/\s]+\/[^/\s]+\/pull\/(\d+)(?:[/?#].*)?$/i;
2323

2424
// GitHub Enterprise Server runs on any hostname, so the `<owner>/<repo>/pull/<n>` route alone
2525
// identifies a GitHub pull request.

0 commit comments

Comments
 (0)