fix #166
This commit is contained in:
parent
4d769fb8f7
commit
78675447a4
9
index.js
9
index.js
|
@ -141,7 +141,8 @@ const workspace = process.env.GITHUB_WORKSPACE;
|
||||||
`"${process.env.GITHUB_EMAIL || 'gh-action-bump-version@users.noreply.github.com'}"`,
|
`"${process.env.GITHUB_EMAIL || 'gh-action-bump-version@users.noreply.github.com'}"`,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1];
|
const refsRegExResult = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF);
|
||||||
|
let currentBranch = refsRegExResult ? refsRegExResult[1] : undefined;
|
||||||
let isPullRequest = false;
|
let isPullRequest = false;
|
||||||
if (process.env.GITHUB_HEAD_REF) {
|
if (process.env.GITHUB_HEAD_REF) {
|
||||||
// Comes from a pull request
|
// Comes from a pull request
|
||||||
|
@ -153,6 +154,12 @@ const workspace = process.env.GITHUB_WORKSPACE;
|
||||||
currentBranch = process.env['INPUT_TARGET-BRANCH'];
|
currentBranch = process.env['INPUT_TARGET-BRANCH'];
|
||||||
}
|
}
|
||||||
console.log('currentBranch:', currentBranch);
|
console.log('currentBranch:', currentBranch);
|
||||||
|
|
||||||
|
if (!currentBranch) {
|
||||||
|
exitFailure('No branch found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// do it in the current checked out github branch (DETACHED HEAD)
|
// do it in the current checked out github branch (DETACHED HEAD)
|
||||||
// important for further usage of the package.json version
|
// important for further usage of the package.json version
|
||||||
await runInWorkspace('npm', ['version', '--allow-same-version=true', '--git-tag-version=false', current]);
|
await runInWorkspace('npm', ['version', '--allow-same-version=true', '--git-tag-version=false', current]);
|
||||||
|
|
Loading…
Reference in New Issue