Skip to content

Commit d4ff3c5

Browse files
committedJan 16, 2024
feat: new patch option for noVersionBumpBehavior
1 parent 1c436e1 commit d4ff3c5

File tree

6 files changed

+21
-11
lines changed

6 files changed

+21
-11
lines changed
 

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
steps:
3434
- name: Checkout Code
35-
uses: actions/checkout@v2
35+
uses: actions/checkout@v4
3636

3737
- name: Get Next Version
3838
id: semver
@@ -63,7 +63,7 @@ jobs:
6363
| `patchList` | Comma separated commit prefixes, used to bump Patch version. | :x: | `fix, bugfix, perf, refactor, test, tests` |
6464
| `patchAll` | If set to `true`, will ignore `patchList` and always count commits as a Patch. | :x: | `false` |
6565
| `skipInvalidTags` | If set to `true`, will skip tags that are not valid semver until it finds a proper one (up to 10 from latest). | :x: | `false` |
66-
| `noVersionBumpBehavior` | Whether to exit with an error *(default)*, a warning, the current version or silently when none of the commits result in a version bump. (Possible values: `error`, `warn`, `current` or `silent`) | :x: | `error` |
66+
| `noVersionBumpBehavior` | Whether to exit with an error *(default)*, a warning, silently, the current version or force bump using patch when none of the commits result in a version bump. (Possible values: `error`, `warn`, `current`, `patch` or `silent`) | :x: | `error` |
6767
| `noNewCommitBehavior` | Whether to exit with an error *(default)*, a warning, the current version or silently when there are no new commits since the latest tag. (Possible values: `error`, `warn`, `current` or `silent`) | :x: | `error` |
6868
| `prefix` | A prefix that will be ignored when parsing tags (e.g. `foobar/`). Useful for monorepos. The prefix will be added back to the output values. | :x: | |
6969
| `additionalCommits` | A list of additional commit messages to parse in order to calculate semver. | :x: | |

‎action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ inputs:
3030
required: false
3131
default: 'false'
3232
noVersionBumpBehavior:
33-
description: Whether to exit with an error, warning or silently when none of the commits result in a version bump. (error, warn, current, silent)
33+
description: Whether to exit with an error, warning or silently when none of the commits result in a version bump. (error, warn, current, patch, silent)
3434
required: false
3535
default: error
3636
noNewCommitBehavior:
@@ -60,7 +60,7 @@ outputs:
6060
nextMajorStrict:
6161
description: Next version major number only.
6262
runs:
63-
using: 'node16'
63+
using: 'node20'
6464
main: 'dist/index.js'
6565
branding:
6666
icon: fast-forward

‎dist/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -52965,7 +52965,7 @@ async function main () {
5296552965
major: core.getInput('majorList').split(',').map(p => p.trim()).filter(p => p),
5296652966
minor: core.getInput('minorList').split(',').map(p => p.trim()).filter(p => p),
5296752967
patch: core.getInput('patchList').split(',').map(p => p.trim()).filter(p => p),
52968-
patchAll: (core.getInput('patchAll') === true || core.getInput('patchAll') === 'true'),
52968+
patchAll: (core.getInput('patchAll') === true || core.getInput('patchAll') === 'true')
5296952969
}
5297052970

5297152971
function outputVersion (version) {
@@ -53157,6 +53157,11 @@ async function main () {
5315753157
outputVersion(semver.clean(latestTag.name))
5315853158
return
5315953159
}
53160+
case 'patch': {
53161+
core.info('No commit resulted in a version bump since last release! Defaulting to using PATCH...')
53162+
bump = 'patch'
53163+
break
53164+
}
5316053165
case 'silent': {
5316153166
return core.info('No commit resulted in a version bump since last release! Exiting silently...')
5316253167
}

‎index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function main () {
2121
major: core.getInput('majorList').split(',').map(p => p.trim()).filter(p => p),
2222
minor: core.getInput('minorList').split(',').map(p => p.trim()).filter(p => p),
2323
patch: core.getInput('patchList').split(',').map(p => p.trim()).filter(p => p),
24-
patchAll: (core.getInput('patchAll') === true || core.getInput('patchAll') === 'true'),
24+
patchAll: (core.getInput('patchAll') === true || core.getInput('patchAll') === 'true')
2525
}
2626

2727
function outputVersion (version) {
@@ -213,6 +213,11 @@ async function main () {
213213
outputVersion(semver.clean(latestTag.name))
214214
return
215215
}
216+
case 'patch': {
217+
core.info('No commit resulted in a version bump since last release! Defaulting to using PATCH...')
218+
bump = 'patch'
219+
break
220+
}
216221
case 'silent': {
217222
return core.info('No commit resulted in a version bump since last release! Exiting silently...')
218223
}

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"eslint": "8.56.0",
2929
"eslint-config-standard": "17.1.0",
3030
"eslint-plugin-import": "2.29.1",
31-
"eslint-plugin-n": "16.6.1",
31+
"eslint-plugin-n": "16.6.2",
3232
"eslint-plugin-node": "11.1.0",
3333
"eslint-plugin-promise": "6.1.1"
3434
}

‎yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -628,10 +628,10 @@ eslint-plugin-import@2.29.1:
628628
semver "^6.3.1"
629629
tsconfig-paths "^3.15.0"
630630

631-
eslint-plugin-n@16.6.1:
632-
version "16.6.1"
633-
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.6.1.tgz#b16e0033bc9ce592b1c3512cb1cee24f84ecb5ae"
634-
integrity sha512-M1kE5bVQRLBMDYRZwDhWzlzbp370SRRRC1MHqq4I3L2Tatey+9/2csc5mwLDPlmhJaDvkojbrNUME5/llpRyDg==
631+
eslint-plugin-n@16.6.2:
632+
version "16.6.2"
633+
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.6.2.tgz#6a60a1a376870064c906742272074d5d0b412b0b"
634+
integrity sha512-6TyDmZ1HXoFQXnhCTUjVFULReoBPOAjpuiKELMkeP40yffI/1ZRO+d9ug/VC6fqISo2WkuIBk3cvuRPALaWlOQ==
635635
dependencies:
636636
"@eslint-community/eslint-utils" "^4.4.0"
637637
builtins "^5.0.1"

0 commit comments

Comments
 (0)
Please sign in to comment.