diff --git a/action.yml b/action.yml index 3dfdd86..e4aef50 100644 --- a/action.yml +++ b/action.yml @@ -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" diff --git a/dist/index.js b/dist/index.js index 7daec53..4fb52c0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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 }); diff --git a/index.js b/index.js index ab0310a..8dec0ca 100644 --- a/index.js +++ b/index.js @@ -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 }); diff --git a/index.test.js b/index.test.js index ac8b8c4..8fdae2d 100644 --- a/index.test.js +++ b/index.test.js @@ -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(); +});