5
0
Fork 0
mirror of https://github.com/cycjimmy/semantic-release-action.git synced 2025-11-07 10:46:56 +00:00

Merge pull request #16 from cycjimmy/fix/branch-does-not-work-in-semantic16

fix(branch): parameter `branch` does not work in semantic v16
This commit is contained in:
Geoffrey.C 2020-01-19 10:19:53 +08:00 committed by GitHub
commit 107a6c4f76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View file

@ -16,6 +16,7 @@ jobs:
- name: Semantic Release
uses: ./
with:
branch: master
extra_plugins: |
@semantic-release/git
@semantic-release/changelog

View file

@ -20,6 +20,7 @@ jobs:
uses: cycjimmy/semantic-release-action@v2
id: semantic
with:
branch: master
extra_plugins: |
@semantic-release/git
@semantic-release/changelog

View file

@ -9,8 +9,18 @@ exports.handleBranchOption = () => {
const branchOption = {};
const branch = core.getInput(inputs.branch);
if (branch) {
if (!branch) {
return branchOption;
}
const semanticVersion = require('semantic-release/package.json').version;
const semanticMajorVersion = Number(semanticVersion.replace(/\..+/g, ''));
core.debug(`semanticMajorVersion: ${semanticMajorVersion}`);
if (semanticMajorVersion < 16) {
branchOption.branch = branch;
} else {
branchOption.branches = [branch];
}
return branchOption;