mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 13:08:17 +00:00
Allow empty tag prefix
This commit is contained in:
parent
118c3fd956
commit
8af45c2a76
4 changed files with 17 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ inputs:
|
||||||
default: "master"
|
default: "master"
|
||||||
tag_prefix:
|
tag_prefix:
|
||||||
description: "The prefix to use to identify tags"
|
description: "The prefix to use to identify tags"
|
||||||
required: true
|
required: false
|
||||||
default: "v"
|
default: "v"
|
||||||
major_pattern:
|
major_pattern:
|
||||||
description: "a string which, if present in a git commit, indicates that a change represents a major (breaking) change"
|
description: "a string which, if present in a git commit, indicates that a change represents a major (breaking) change"
|
||||||
|
|
|
||||||
2
dist/index.js
vendored
2
dist/index.js
vendored
|
|
@ -674,7 +674,7 @@ async function run() {
|
||||||
const remoteExists = remote !== '';
|
const remoteExists = remote !== '';
|
||||||
const remotePrefix = remoteExists ? 'origin/' : '';
|
const remotePrefix = remoteExists ? 'origin/' : '';
|
||||||
|
|
||||||
const tagPrefix = core.getInput('tag_prefix', { required: true });
|
const tagPrefix = core.getInput('tag_prefix') || '';
|
||||||
const branch = `${remotePrefix}${core.getInput('branch', { required: true })}`;
|
const branch = `${remotePrefix}${core.getInput('branch', { required: true })}`;
|
||||||
const majorPattern = core.getInput('major_pattern', { required: true });
|
const majorPattern = core.getInput('major_pattern', { required: true });
|
||||||
const minorPattern = core.getInput('minor_pattern', { required: true });
|
const minorPattern = core.getInput('minor_pattern', { required: true });
|
||||||
|
|
|
||||||
2
index.js
2
index.js
|
|
@ -38,7 +38,7 @@ async function run() {
|
||||||
const remoteExists = remote !== '';
|
const remoteExists = remote !== '';
|
||||||
const remotePrefix = remoteExists ? 'origin/' : '';
|
const remotePrefix = remoteExists ? 'origin/' : '';
|
||||||
|
|
||||||
const tagPrefix = core.getInput('tag_prefix', { required: true });
|
const tagPrefix = core.getInput('tag_prefix') || '';
|
||||||
const branch = `${remotePrefix}${core.getInput('branch', { required: true })}`;
|
const branch = `${remotePrefix}${core.getInput('branch', { required: true })}`;
|
||||||
const majorPattern = core.getInput('major_pattern', { required: true });
|
const majorPattern = core.getInput('major_pattern', { required: true });
|
||||||
const minorPattern = core.getInput('minor_pattern', { required: true });
|
const minorPattern = core.getInput('minor_pattern', { required: true });
|
||||||
|
|
|
||||||
|
|
@ -251,4 +251,17 @@ test('Format input is respected', () => {
|
||||||
expect(result).toMatch('M1m2p4i0');
|
expect(result).toMatch('M1m2p4i0');
|
||||||
|
|
||||||
repo.clean();
|
repo.clean();
|
||||||
})
|
});
|
||||||
|
|
||||||
|
test('Version prefixes are not required/can be empty', () => {
|
||||||
|
const repo = createTestRepo({ tag_prefix: '' }); // 0.0.0
|
||||||
|
|
||||||
|
repo.makeCommit('Initial Commit'); // 0.0.1
|
||||||
|
repo.exec('git tag 0.0.1');
|
||||||
|
repo.makeCommit(`Second Commit`); // 0.0.2
|
||||||
|
const result = repo.runAction();
|
||||||
|
|
||||||
|
expect(result).toMatch('Version is 0.0.2');
|
||||||
|
|
||||||
|
repo.clean();
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue