diff --git a/scripts/nx-release.ts b/scripts/nx-release.ts index db2ddedec0b6e..fc13f0ef490af 100755 --- a/scripts/nx-release.ts +++ b/scripts/nx-release.ts @@ -129,6 +129,17 @@ const VALID_AUTHORS_FOR_LATEST = [ }); const distTag = determineDistTag(options.version); + if (!distTag || distTag === 'latest') { + // We are only expecting latest releases to be performed within publish.yml on GitHub + const author = process.env.GITHUB_ACTOR ?? ''; + if (!VALID_AUTHORS_FOR_LATEST.includes(author)) { + throw new Error( + `The GitHub user "${author}" is not allowed to publish to "latest". Please request one of the following users to carry out the release: ${VALID_AUTHORS_FOR_LATEST.join( + ', ' + )}` + ); + } + } if (options.dryRun) { console.warn('Not Publishing because --dryRun was passed');