Get head branch from PRs

This commit is contained in:
Jacob Lauritzen 2020-09-26 14:13:48 +02:00 committed by GitHub
parent 69d4b3888a
commit c3025e2dfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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.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)
// do it in the current checked out github branch (DETACHED HEAD)
// important for further usage of the package.json version
await tools.runInWorkspace('npm',