Allow empty tag prefix

This commit is contained in:
Paul Hatcherian 2019-12-11 23:39:03 -05:00
parent 118c3fd956
commit 8af45c2a76
4 changed files with 17 additions and 4 deletions

View file

@ -10,7 +10,7 @@ inputs:
default: "master"
tag_prefix:
description: "The prefix to use to identify tags"
required: true
required: false
default: "v"
major_pattern:
description: "a string which, if present in a git commit, indicates that a change represents a major (breaking) change"

2
dist/index.js vendored
View file

@ -674,7 +674,7 @@ async function run() {
const remoteExists = remote !== '';
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 majorPattern = core.getInput('major_pattern', { required: true });
const minorPattern = core.getInput('minor_pattern', { required: true });

View file

@ -38,7 +38,7 @@ async function run() {
const remoteExists = remote !== '';
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 majorPattern = core.getInput('major_pattern', { required: true });
const minorPattern = core.getInput('minor_pattern', { required: true });

View file

@ -251,4 +251,17 @@ test('Format input is respected', () => {
expect(result).toMatch('M1m2p4i0');
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();
});