Remove origin prefix from branch name

This commit is contained in:
Paul Hatcherian 2021-02-08 20:52:41 -05:00
parent ac2e147b35
commit 01ccd0e687
3 changed files with 6 additions and 14 deletions

8
dist/index.js vendored
View file

@ -1130,11 +1130,7 @@ const createMatchTest = (pattern) => {
async function run() {
try {
const remote = await cmd('git', 'remote');
const remoteExists = remote !== '';
const remotePrefix = remoteExists ? 'origin/' : '';
let branch = `${remotePrefix}${core.getInput('branch', { required: true })}`;
let branch = core.getInput('branch', { required: true });
const majorPattern = createMatchTest(core.getInput('major_pattern', { required: true }));
const minorPattern = createMatchTest(core.getInput('minor_pattern', { required: true }));
const changePath = core.getInput('change_path') || '';
@ -1177,7 +1173,7 @@ async function run() {
let root;
if (tag === '') {
if (remoteExists) {
if (await cmd('git', 'remote') !== '') {
core.warning('No tags are present for this repository. If this is unexpected, check to ensure that tags have been pulled from the remote.');
}
// no release tags yet, use the initial commit as the root

View file

@ -109,11 +109,7 @@ const createMatchTest = (pattern) => {
async function run() {
try {
const remote = await cmd('git', 'remote');
const remoteExists = remote !== '';
const remotePrefix = remoteExists ? 'origin/' : '';
let branch = `${remotePrefix}${core.getInput('branch', { required: true })}`;
let branch = core.getInput('branch', { required: true });
const majorPattern = createMatchTest(core.getInput('major_pattern', { required: true }));
const minorPattern = createMatchTest(core.getInput('minor_pattern', { required: true }));
const changePath = core.getInput('change_path') || '';
@ -156,7 +152,7 @@ async function run() {
let root;
if (tag === '') {
if (remoteExists) {
if (await cmd('git', 'remote') !== '') {
core.warning('No tags are present for this repository. If this is unexpected, check to ensure that tags have been pulled from the remote.');
}
// no release tags yet, use the initial commit as the root

View file

@ -6,7 +6,7 @@ const windows = process.platform === "win32";
// Action input variables
const defaultInputs = {
branch: "master",
branch: "HEAD",
tag_prefix: "v",
major_pattern: "(MAJOR)",
minor_pattern: "(MINOR)",
@ -86,7 +86,7 @@ test('Repository with commits shows increment', () => {
});
test('Repository show commit for checked out commit', () => {
const repo = createTestRepo({ branch: 'HEAD' }); // 0.0.0+0
const repo = createTestRepo(); // 0.0.0+0
repo.makeCommit('Initial Commit'); // 0.0.1+0
repo.makeCommit(`Second Commit`); // 0.0.1+1