diff --git a/.github/workflows/checkPullRequest.yml b/.github/workflows/checkPullRequest.yml index 6da633e..e27ee90 100644 --- a/.github/workflows/checkPullRequest.yml +++ b/.github/workflows/checkPullRequest.yml @@ -16,6 +16,7 @@ jobs: - name: Semantic Release uses: ./ with: + branch: master extra_plugins: | @semantic-release/git @semantic-release/changelog diff --git a/.github/workflows/testRelease.yml b/.github/workflows/testRelease.yml index b61e6af..b0257d5 100644 --- a/.github/workflows/testRelease.yml +++ b/.github/workflows/testRelease.yml @@ -20,6 +20,7 @@ jobs: uses: cycjimmy/semantic-release-action@v2 id: semantic with: + branch: master extra_plugins: | @semantic-release/git @semantic-release/changelog diff --git a/src/handleOptions.js b/src/handleOptions.js index 281a03d..3330708 100644 --- a/src/handleOptions.js +++ b/src/handleOptions.js @@ -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;