Skip to content

Commit

Permalink
Merge pull request #191 from kevcube/fix_version_type
Browse files Browse the repository at this point in the history
fix prerelease version selection when version-type is set
  • Loading branch information
phips28 authored Oct 26, 2022
2 parents 0bab495 + 9331590 commit a60a866
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const pkg = getPackageJson();
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'])) {
exitFailure('Invalid version type');
return;
Expand Down Expand Up @@ -103,7 +103,7 @@ const pkg = getPackageJson();
}),
)
) {
if (foundWord !== ''){
if (foundWord !== '') {
preid = foundWord.split('-')[1];
}
version = 'prerelease';
Expand All @@ -114,18 +114,18 @@ const pkg = getPackageJson();
// case: if default=prerelease,
// rc-wording is also set
// and does not include any of rc-wording
// and version-type is not strictly set
// then unset it and do not run
if (
version === 'prerelease' &&
preReleaseWords &&
!messages.some((message) => preReleaseWords.some((word) => message.includes(word)))
!messages.some((message) => preReleaseWords.some((word) => message.includes(word)) && !versionType)
) {
version = null;
}

// case: if default=prerelease, but rc-wording is NOT set
if (version === 'prerelease' && preid) {
version = 'prerelease';
version = `${version} --preid=${preid}`;
}

Expand Down

0 comments on commit a60a866

Please sign in to comment.