diff --git a/packages/nx/release/changelog-renderer/index.ts b/packages/nx/release/changelog-renderer/index.ts index 26e9ca80b4ec2..b1eaf6667a91d 100644 --- a/packages/nx/release/changelog-renderer/index.ts +++ b/packages/nx/release/changelog-renderer/index.ts @@ -55,6 +55,7 @@ export type ChangelogRenderer = (config: { entryWhenNoChanges: string | false; changelogRenderOptions: DefaultChangelogRenderOptions; dependencyBumps?: DependencyBump[]; + // TODO(v20): remove repoSlug in favour of repoData repoSlug?: RepoSlug; repoData?: GithubRepoData; // TODO(v20): Evaluate if there is a cleaner way to configure this when breaking changes are allowed diff --git a/packages/nx/schemas/nx-schema.json b/packages/nx/schemas/nx-schema.json index 23998fc4d10fe..b098deb964482 100644 --- a/packages/nx/schemas/nx-schema.json +++ b/packages/nx/schemas/nx-schema.json @@ -691,6 +691,9 @@ { "type": "boolean", "enum": [false] + }, + { + "ref": "#/definitions/CreateReleaseProviderConfiguration" } ] }, @@ -724,6 +727,24 @@ } } }, + "CreateReleaseProviderConfiguration": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["github-enterprise-server"] + }, + "hostname": { + "type": "string", + "description": "The hostname of the VCS provider instance, e.g. github.example.com" + }, + "apiBaseUrl": { + "type": "string", + "description": "The base URL for the relevant VCS provider API. If not set, this will default to `https://${hostname}/api/v3`" + } + }, + "required": ["provider", "hostname"] + }, "NxReleaseVersionPlansConfiguration": { "type": "object", "properties": { diff --git a/packages/nx/src/command-line/release/utils/github.ts b/packages/nx/src/command-line/release/utils/github.ts index 76c3e27388dff..5f70fec8d27fc 100644 --- a/packages/nx/src/command-line/release/utils/github.ts +++ b/packages/nx/src/command-line/release/utils/github.ts @@ -68,7 +68,7 @@ export function getGitHubRepoData( // Extract the 'user/repo' part from the URL const escapedHostname = hostname.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - const regexString = `${escapedHostname}[/:]([\\w-]+/[\\w-]+)`; + const regexString = `${escapedHostname}[/:]([\\w.-]+/[\\w.-]+)(\\.git)?`; const regex = new RegExp(regexString); const match = remoteUrl.match(regex); @@ -370,6 +370,9 @@ async function resolveGithubToken(hostname: string): Promise { } } } + console.log( + `Warning: It was not possible to automatically resolve a GitHub token from your environment for hostname ${hostname}. If you set the GITHUB_TOKEN or GH_TOKEN environment variable, that will be used for GitHub API requests.` + ); return null; }