Skip to content

Commit

Permalink
chore(repo): check valid release authors for latest (#22127)
Browse files Browse the repository at this point in the history
(cherry picked from commit 80ae397)
  • Loading branch information
JamesHenry authored and FrozenPandaz committed Mar 8, 2024
1 parent 6f22121 commit f20a51c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/nx-release.ts
Expand Up @@ -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');
Expand Down

0 comments on commit f20a51c

Please sign in to comment.