From ae38bb6a2646c103dee2f9c2875aeb072e24e3ba Mon Sep 17 00:00:00 2001 From: phips28 Date: Sun, 27 Oct 2019 01:52:27 +0200 Subject: [PATCH] checkout current branch --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 3df3282..8b03bf2 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,6 @@ const { execSync } = require('child_process') Toolkit.run(async tools => { const pkg = tools.getPackageJSON() const event = tools.context.payload - // console.log('payload:', event) const messages = event.commits.map(commit => commit.message + '\n' + commit.body) @@ -29,6 +28,9 @@ Toolkit.run(async tools => { await tools.runInWorkspace('git', ['config', 'user.name', '"Automated Version Bump"']) await tools.runInWorkspace('git', ['config', 'user.email', '"gh-action-bump-version@users.noreply.github.com"']) + const currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF) + console.log('currentBranch:', currentBranch) + await tools.runInWorkspace('git', ['checkout', currentBranch]) await tools.runInWorkspace('npm', ['version', '--allow-same-version=true', '--git-tag-version=false', current]) console.log('current:', current, '/', 'version:', version)