Skip to content

Commit

Permalink
feat: new patch option for noVersionBumpBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Jan 16, 2024
1 parent 1c436e1 commit d4ff3c5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Get Next Version
id: semver
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
| `patchList` | Comma separated commit prefixes, used to bump Patch version. | :x: | `fix, bugfix, perf, refactor, test, tests` |
| `patchAll` | If set to `true`, will ignore `patchList` and always count commits as a Patch. | :x: | `false` |
| `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` |
| `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` |
| `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` |
| `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` |
| `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: | |
| `additionalCommits` | A list of additional commit messages to parse in order to calculate semver. | :x: | |
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ inputs:
required: false
default: 'false'
noVersionBumpBehavior:
description: Whether to exit with an error, warning or silently when none of the commits result in a version bump. (error, warn, current, silent)
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)
required: false
default: error
noNewCommitBehavior:
Expand Down Expand Up @@ -60,7 +60,7 @@ outputs:
nextMajorStrict:
description: Next version major number only.
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
branding:
icon: fast-forward
Expand Down
7 changes: 6 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52965,7 +52965,7 @@ async function main () {
major: core.getInput('majorList').split(',').map(p => p.trim()).filter(p => p),
minor: core.getInput('minorList').split(',').map(p => p.trim()).filter(p => p),
patch: core.getInput('patchList').split(',').map(p => p.trim()).filter(p => p),
patchAll: (core.getInput('patchAll') === true || core.getInput('patchAll') === 'true'),
patchAll: (core.getInput('patchAll') === true || core.getInput('patchAll') === 'true')
}

function outputVersion (version) {
Expand Down Expand Up @@ -53157,6 +53157,11 @@ async function main () {
outputVersion(semver.clean(latestTag.name))
return
}
case 'patch': {
core.info('No commit resulted in a version bump since last release! Defaulting to using PATCH...')
bump = 'patch'
break
}
case 'silent': {
return core.info('No commit resulted in a version bump since last release! Exiting silently...')
}
Expand Down
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function main () {
major: core.getInput('majorList').split(',').map(p => p.trim()).filter(p => p),
minor: core.getInput('minorList').split(',').map(p => p.trim()).filter(p => p),
patch: core.getInput('patchList').split(',').map(p => p.trim()).filter(p => p),
patchAll: (core.getInput('patchAll') === true || core.getInput('patchAll') === 'true'),
patchAll: (core.getInput('patchAll') === true || core.getInput('patchAll') === 'true')
}

function outputVersion (version) {
Expand Down Expand Up @@ -213,6 +213,11 @@ async function main () {
outputVersion(semver.clean(latestTag.name))
return
}
case 'patch': {
core.info('No commit resulted in a version bump since last release! Defaulting to using PATCH...')
bump = 'patch'
break
}
case 'silent': {
return core.info('No commit resulted in a version bump since last release! Exiting silently...')
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"eslint": "8.56.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-n": "16.6.1",
"eslint-plugin-n": "16.6.2",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "6.1.1"
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,10 @@ [email protected]:
semver "^6.3.1"
tsconfig-paths "^3.15.0"

[email protected].1:
version "16.6.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.6.1.tgz#b16e0033bc9ce592b1c3512cb1cee24f84ecb5ae"
integrity sha512-M1kE5bVQRLBMDYRZwDhWzlzbp370SRRRC1MHqq4I3L2Tatey+9/2csc5mwLDPlmhJaDvkojbrNUME5/llpRyDg==
[email protected].2:
version "16.6.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.6.2.tgz#6a60a1a376870064c906742272074d5d0b412b0b"
integrity sha512-6TyDmZ1HXoFQXnhCTUjVFULReoBPOAjpuiKELMkeP40yffI/1ZRO+d9ug/VC6fqISo2WkuIBk3cvuRPALaWlOQ==
dependencies:
"@eslint-community/eslint-utils" "^4.4.0"
builtins "^5.0.1"
Expand Down

0 comments on commit d4ff3c5

Please sign in to comment.