Get head branch from PRs
This commit is contained in:
parent
69d4b3888a
commit
c3025e2dfa
7
index.js
7
index.js
|
@ -39,9 +39,12 @@ Toolkit.run(async tools => {
|
||||||
await tools.runInWorkspace('git', ['config', 'user.name', `"${process.env.GITHUB_USER || 'Automated Version Bump'}"`])
|
await tools.runInWorkspace('git', ['config', 'user.name', `"${process.env.GITHUB_USER || 'Automated Version Bump'}"`])
|
||||||
await tools.runInWorkspace('git', ['config', 'user.email', `"${process.env.GITHUB_EMAIL || 'gh-action-bump-version@users.noreply.github.com'}"`])
|
await tools.runInWorkspace('git', ['config', 'user.email', `"${process.env.GITHUB_EMAIL || 'gh-action-bump-version@users.noreply.github.com'}"`])
|
||||||
|
|
||||||
const currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1]
|
let currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1]
|
||||||
|
if (process.env.GITHUB_HEAD_REF) {
|
||||||
|
console.log('Is pull request');
|
||||||
|
currentBranch = process.env.GITHUB_HEAD_REF;
|
||||||
|
}
|
||||||
console.log('currentBranch:', currentBranch)
|
console.log('currentBranch:', currentBranch)
|
||||||
|
|
||||||
// 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 tools.runInWorkspace('npm',
|
await tools.runInWorkspace('npm',
|
||||||
|
|
Loading…
Reference in New Issue