Parses a GitHub pull request or issue URL into its components.
Only accepts HTTPS GitHub URLs (https://github.com/...). Returns null for invalid URLs, non-GitHub URLs, or URLs with invalid owner/repo characters.
https://github.com/...
null
Full GitHub URL (e.g., "https://github.com/owner/repo/pull/42")
"https://github.com/owner/repo/pull/42"
Parsed URL components, or null if the URL is invalid or not a recognized GitHub PR/issue URL
parseGitHubUrl('https://github.com/facebook/react/pull/123')// { owner: "facebook", repo: "react", number: 123, type: "pull" } Copy
parseGitHubUrl('https://github.com/facebook/react/pull/123')// { owner: "facebook", repo: "react", number: 123, type: "pull" }
parseGitHubUrl('https://github.com/vercel/next.js/issues/456')// { owner: "vercel", repo: "next.js", number: 456, type: "issues" } Copy
parseGitHubUrl('https://github.com/vercel/next.js/issues/456')// { owner: "vercel", repo: "next.js", number: 456, type: "issues" }
parseGitHubUrl('https://example.com/not-github')// null Copy
parseGitHubUrl('https://example.com/not-github')// null
Parses a GitHub pull request or issue URL into its components.
Only accepts HTTPS GitHub URLs (
https://github.com/...). Returnsnullfor invalid URLs, non-GitHub URLs, or URLs with invalid owner/repo characters.