MCPcopy Create free account
hub / github.com/github/gh-aw / parseProjectInput

Function parseProjectInput

actions/setup/js/update_project.cjs:54–65  ·  view source on GitHub ↗

* Parse project number from URL * @param {unknown} projectUrl - Project URL * @returns {string} Project number

(projectUrl)

Source from the content-addressed store, hash-verified

52 * @returns {string} Project number
53 */
54function 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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected