[codex] Canonicalize PR number references (#1749)
This commit is contained in:
1 parent
f2cd53f232
commit
cd7980b457
2 files changed
+3
-3
No files matched your search
@@ -14,7 +14,7 @@ describe("parsePullRequestReference", () => {
|
||||
});
|
||||
|
||||
it("accepts #number references", () => {
|
||||
expect(parsePullRequestReference("#42")).toBe("#42");
|
||||
expect(parsePullRequestReference("#42")).toBe("42");
|
||||
});
|
||||
|
||||
it("accepts gh pr checkout commands with raw numbers", () => {
|
||||
@@ -22,7 +22,7 @@ describe("parsePullRequestReference", () => {
|
||||
});
|
||||
|
||||
it("accepts gh pr checkout commands with #number references", () => {
|
||||
expect(parsePullRequestReference("gh pr checkout #42")).toBe("#42");
|
||||
expect(parsePullRequestReference("gh pr checkout #42")).toBe("42");
|
||||
});
|
||||
|
||||
it("accepts gh pr checkout commands with GitHub pull request URLs", () => {
|
||||
|
||||
@@ -22,7 +22,7 @@ export function parsePullRequestReference(input: string): string | null {
|
||||
|
||||
const numberMatch = PULL_REQUEST_NUMBER_PATTERN.exec(normalizedInput);
|
||||
if (numberMatch?.[1]) {
|
||||
return normalizedInput.startsWith("#") ? normalizedInput : numberMatch[1];
|
||||
return numberMatch[1];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user