Merge pull request #191 from kevcube/fix_version_type

fix prerelease version selection when version-type is set
This commit is contained in:
Phil 2022-10-26 21:22:01 +02:00 committed by GitHub
commit a60a8663b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ const pkg = getPackageJson();
console.log("Couldn't find any commits in this event, incrementing patch version..."); console.log("Couldn't find any commits in this event, incrementing patch version...");
} }
const allowedTypes = ['major', 'minor', 'patch', 'prerelease'] const allowedTypes = ['major', 'minor', 'patch', 'prerelease'];
if (process.env['INPUT_VERSION-TYPE'] && !allowedTypes.includes(process.env['INPUT_VERSION-TYPE'])) { if (process.env['INPUT_VERSION-TYPE'] && !allowedTypes.includes(process.env['INPUT_VERSION-TYPE'])) {
exitFailure('Invalid version type'); exitFailure('Invalid version type');
return; return;
@ -114,18 +114,18 @@ const pkg = getPackageJson();
// case: if default=prerelease, // case: if default=prerelease,
// rc-wording is also set // rc-wording is also set
// and does not include any of rc-wording // and does not include any of rc-wording
// and version-type is not strictly set
// then unset it and do not run // then unset it and do not run
if ( if (
version === 'prerelease' && version === 'prerelease' &&
preReleaseWords && preReleaseWords &&
!messages.some((message) => preReleaseWords.some((word) => message.includes(word))) !messages.some((message) => preReleaseWords.some((word) => message.includes(word)) && !versionType)
) { ) {
version = null; version = null;
} }
// case: if default=prerelease, but rc-wording is NOT set // case: if default=prerelease, but rc-wording is NOT set
if (version === 'prerelease' && preid) { if (version === 'prerelease' && preid) {
version = 'prerelease';
version = `${version} --preid=${preid}`; version = `${version} --preid=${preid}`;
} }