mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-10 20:21:17 +00:00
change regex to support non-github.com URLs
This commit is contained in:
@@ -4,7 +4,7 @@ import * as github from '@actions/github'
|
|||||||
// TODO: Ensure this (and the Octokit client) works for non-github.com URLs, as well.
|
// TODO: Ensure this (and the Octokit client) works for non-github.com URLs, as well.
|
||||||
// https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
|
// https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
|
||||||
const urlParse =
|
const urlParse =
|
||||||
/^(?:https:\/\/)?github\.com\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
|
/\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
|
||||||
|
|
||||||
interface ProjectNodeIDResponse {
|
interface ProjectNodeIDResponse {
|
||||||
organization?: {
|
organization?: {
|
||||||
@@ -80,7 +80,7 @@ export async function addToProject(): Promise<void> {
|
|||||||
|
|
||||||
if (!urlMatch) {
|
if (!urlMatch) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Invalid project URL: ${projectUrl}. Project URL should match the format https://github.com/<orgs-or-users>/<ownerName>/projects/<projectNumber>`,
|
`Invalid project URL: ${projectUrl}. Project URL should match the format <Github server FQDN>/<orgs-or-users>/<ownerName>/projects/<projectNumber>`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user