Attempt to fix prerelease

This commit is contained in:
mariosch 2021-07-01 15:16:01 +03:00
parent 1b7321ba33
commit f31cb5f0ed
1 changed files with 9 additions and 16 deletions

View File

@ -30,8 +30,8 @@ Toolkit.run(async (tools) => {
const majorWords = process.env['INPUT_MAJOR-WORDING'].split(','); const majorWords = process.env['INPUT_MAJOR-WORDING'].split(',');
const minorWords = process.env['INPUT_MINOR-WORDING'].split(','); const minorWords = process.env['INPUT_MINOR-WORDING'].split(',');
const preReleaseWords = process.env['INPUT_RC-WORDING'].split(',');
const patchWords = process.env['INPUT_PATCH-WORDING'].split(','); const patchWords = process.env['INPUT_PATCH-WORDING'].split(',');
const preReleaseWords = process.env['INPUT_RC-WORDING'].split(',');
let version = process.env.INPUT_DEFAULT; let version = process.env.INPUT_DEFAULT;
let foundWord = null; let foundWord = null;
@ -48,6 +48,9 @@ Toolkit.run(async (tools) => {
} else if (messages.some((message) => minorWords.some((word) => message.includes(word)))) { } else if (messages.some((message) => minorWords.some((word) => message.includes(word)))) {
version = 'minor'; version = 'minor';
tools.log('Version is set to minor'); tools.log('Version is set to minor');
} else if (messages.some((message) => patchWords.some((word) => message.includes(word)))) {
version = 'patch';
tools.log('Version is set to patch');
} else if ( } else if (
messages.some((message) => messages.some((message) =>
preReleaseWords.some((word) => { preReleaseWords.some((word) => {
@ -63,16 +66,6 @@ Toolkit.run(async (tools) => {
preid = foundWord.split('-')[1]; preid = foundWord.split('-')[1];
version = 'prerelease'; version = 'prerelease';
tools.log('Version is set to prerelease2'); tools.log('Version is set to prerelease2');
} else if (Array.isArray(patchWords) && patchWords.length) {
tools.log('PatchWords is set : ' + patchWords);
if (!messages.some((message) => patchWords.some((word) => message.includes(word)))) {
tools.log('Messages found on the patchwords : ' + messages);
version = null;
tools.log('Version is set to null 2');
}
} else if (process.env.INPUT_DEFAULT === 'prerelease'){
tools.log('Version is set to prerelease');
version = 'prerelease';
} }
// case: if default=prerelease, but rc-wording is also set // case: if default=prerelease, but rc-wording is also set
@ -81,12 +74,12 @@ Toolkit.run(async (tools) => {
tools.log(version); // null tools.log(version); // null
tools.log('PreID: ' + preid); //prc tools.log('PreID: ' + preid); //prc
tools.log(process.env.INPUT_DEFAULT); tools.log(process.env.INPUT_DEFAULT);
if (version === 'prerelease' && !messages.some((message) => preReleaseWords.some((word) => message.includes(word)))) { // if (version === 'prerelease' && !messages.some((message) => preReleaseWords.some((word) => message.includes(word)))) {
tools.log('Version is set to null'); // tools.log('Version is set to null');
version = null; // version = null;
} // }
if (version === 'prerelease' || process.env.INPUT_DEFAULT === 'prerelease' && preid) { if (version === 'prerelease' || (process.env.INPUT_DEFAULT === 'prerelease' && preid)) {
tools.log('Version is prerelease and it contains a preid'); tools.log('Version is prerelease and it contains a preid');
version = 'prerelease'; version = 'prerelease';
version = `${version} --preid=${preid}`; version = `${version} --preid=${preid}`;