Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(repo): check valid release authors for latest #22127

Merged
merged 1 commit into from Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions scripts/nx-release.ts
Expand Up @@ -11,6 +11,14 @@ import * as yargs from 'yargs';

const LARGE_BUFFER = 1024 * 1000000;

// DO NOT MODIFY, even for testing. This only gates releases to latest.
const VALID_AUTHORS_FOR_LATEST = [
'jaysoo',
'JamesHenry',
'FrozenPandaz',
'vsavkin',
];

(async () => {
const options = parseArgs();
// Perform minimal logging by default
Expand Down Expand Up @@ -121,6 +129,17 @@ const LARGE_BUFFER = 1024 * 1000000;
});

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