Support gh pr checkout pull request references (#1457)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-03-27 00:08:45 -07:00
1 parent 02989fe600
commit d8a485ea7e
8 files changed
+324 -17

No files matched your search

+14
View File
@@ -17,6 +17,20 @@ describe("parsePullRequestReference", () => {
expect(parsePullRequestReference("#42")).toBe("#42");
});
it("accepts gh pr checkout commands with raw numbers", () => {
expect(parsePullRequestReference("gh pr checkout 42")).toBe("42");
});
it("accepts gh pr checkout commands with #number references", () => {
expect(parsePullRequestReference("gh pr checkout #42")).toBe("#42");
});
it("accepts gh pr checkout commands with GitHub pull request URLs", () => {
expect(
parsePullRequestReference("gh pr checkout https://github.com/pingdotgg/t3code/pull/42"),
).toBe("https://github.com/pingdotgg/t3code/pull/42");
});
it("rejects non-pull-request input", () => {
expect(parsePullRequestReference("feature/my-branch")).toBeNull();
});