* Parse project number from URL * @param {unknown} projectUrl - Project URL * @returns {string} Project number
(projectUrl)
| 52 | * @returns {string} Project number |
| 53 | */ |
| 54 | function parseProjectInput(projectUrl) { |
| 55 | if (!projectUrl || typeof projectUrl !== "string") { |
| 56 | throw new Error(`${ERR_VALIDATION}: Invalid project input: expected string, got ${typeof projectUrl}. The "project" field is required and must be a full GitHub project URL.`); |
| 57 | } |
| 58 | |
| 59 | const urlMatch = projectUrl.match(/^https:\/\/[^/]+\/(?:users|orgs)\/[^/]+\/projects\/(\d+)/); |
| 60 | if (!urlMatch) { |
| 61 | throw new Error(`${ERR_VALIDATION}: Invalid project URL: "${projectUrl}". The "project" field must be a full GitHub project URL (e.g., https://github.com/orgs/myorg/projects/123).`); |
| 62 | } |
| 63 | |
| 64 | return urlMatch[1]; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Parse project URL into components |
no outgoing calls
no test coverage detected