(rawUrl: string)
| 95 | } |
| 96 | |
| 97 | function prNumberFromUrl(rawUrl: string): number | null { |
| 98 | let url: URL; |
| 99 | try { |
| 100 | url = new URL(rawUrl); |
| 101 | } catch { |
| 102 | return null; |
| 103 | } |
| 104 | const parts = url.pathname.split("/").filter(Boolean); |
| 105 | const pullIndex = parts.indexOf("pull"); |
| 106 | if (pullIndex < 0 || pullIndex + 1 >= parts.length) return null; |
| 107 | if (url.hostname === "review.cursor.com") { |
| 108 | if (parts[0] !== "github" || pullIndex !== 3) return null; |
| 109 | } else if (url.hostname === "github.com") { |
| 110 | if (pullIndex !== 2) return null; |
| 111 | } else { |
| 112 | return null; |
| 113 | } |
| 114 | const number = Number.parseInt(parts[pullIndex + 1], 10); |
| 115 | return Number.isInteger(number) && number > 0 ? number : null; |
| 116 | } |
| 117 | |
| 118 | function readSectionValue(args: { |
| 119 | handoff: string; |
no outgoing calls
no test coverage detected