From 35e0718db49fa3d7900d7e1c2400d4932ca25fe7 Mon Sep 17 00:00:00 2001 From: alehechka <42357034+alehechka@users.noreply.github.com> Date: Fri, 9 Oct 2020 11:55:11 -0500 Subject: [PATCH] Adding patch and rc param options --- README.md | 3 +++ action.yml | 5 +++++ index.js | 12 +++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 23f58e2..02f2e3a 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,9 @@ Make sure you use the `actions/checkout@v2` action! with: minor-wording: 'add,Adds,new' major-wording: 'MAJOR,cut-major' + patch-wording: 'patch, fixes' # Providing patch-wording will override commits + # defaulting to a patch bump. + rc-wording: 'RELEASE, alpha' ``` **PACKAGEJSON_DIR:** Param to parse the location of the desired package.json (optional). Example: diff --git a/action.yml b/action.yml index 44def64..bd0154c 100644 --- a/action.yml +++ b/action.yml @@ -18,6 +18,11 @@ inputs: major-wording: description: 'Words list that trigger a major version bump' default: 'BREAKING CHANGE,major' + patch-wording: + description: 'Words list that trigger a patch version bump' + rc-wording: + description: 'Words list that trigger a patch version bump' + default: 'pre-alpha,pre-beta,pre-rc' skip-tag: description: 'Avoid to add a TAG to the version update commit' default: 'false' diff --git a/index.js b/index.js index 3053e37..a9ef6be 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,8 @@ Toolkit.run(async tools => { const majorWords = process.env['INPUT_MAJOR-WORDING'].split(',') const minorWords = process.env['INPUT_MINOR-WORDING'].split(',') - const preReleaseWords = ['pre-alpha', 'pre-beta', 'pre-rc'] + const patchWords = process.env['INPUT_PATCH-WORDING'].split(',') + const preReleaseWords = process.env['INPUT_RC-WORDING'].split(',') let version = 'patch' let foundWord = null; @@ -49,6 +50,15 @@ Toolkit.run(async tools => { ))) { const preid = foundWord.split("-")[1]; version = `prerelease --preid=${preid}`; + } else if (patchWords && Array.isArray(patchWords)) { + if (!messages.some(message => patchWords.some(word => message.includes(word)))) { + version = null + } + } + + if (version === null) { + tools.exit.success('No version keywords found, skipping bump.') + return } try {