Update setting name and README

This commit is contained in:
Daniel Kao 2020-11-25 22:47:18 +08:00
parent 5d776519d3
commit 1f7f2d1296
No known key found for this signature in database
GPG Key ID: C0B460E9BB89027B
3 changed files with 14 additions and 3 deletions

View File

@ -76,3 +76,13 @@ Make sure you use the `actions/checkout@v2` action!
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: 'frontend'
```
**TARGET-BRANCH:** Set a custom target branch to use when bumping the version. Useful in cases such as updating the version on master after a tag has been set (optional). Example:
```yaml
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target-branch: 'master'
```

View File

@ -31,7 +31,7 @@ inputs:
description: 'Custom dir to the package'
default: ''
required: false
branch:
target-branch:
description: 'A separate branch to perform the version bump on'
default: ''
required: false

View File

@ -78,8 +78,9 @@ Toolkit.run(async tools => {
currentBranch = process.env.GITHUB_HEAD_REF
isPullRequest = true
}
if (process.env['INPUT_TAG-BRANCH']) {
currentBranch = process.env['INPUT_TAG-BRANCH']
if (process.env['INPUT_TARGET-BRANCH']) {
// We want to override the branch that we are pulling / pushing to
currentBranch = process.env['INPUT_TARGET-BRANCH']
}
console.log('currentBranch:', currentBranch)
// do it in the current checked out github branch (DETACHED HEAD)