Skip to content

Commit

Permalink
add base-branch option to only consider version tags on the PR base b…
Browse files Browse the repository at this point in the history
…ranch (#25)

* add base-branch option to only consider version tags on the PR base branch

* add base-branch example to CI example README

* add missing tests for version.js

* read from GITHUB_REF when PR closed

* consider tags on BASE, not HEAD branch

* support branches with / in the name
  • Loading branch information
jtgrohn committed Oct 29, 2022
1 parent 1a27a8e commit d9a5825
Show file tree
Hide file tree
Showing 9 changed files with 282 additions and 5,806 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Inputs can be used to customize the behavior of the action in both modes.
| `release-notes-prefix` | If defined, constrains release notes to any text appearing after a line matching this pattern in the pull request body. By default, release notes start at the beginning of the pull request description. |
| `release-notes-suffix` | If defined, constrains release notes to any text appearing before a line matching this pattern in the pull request body. By default, release notes end at the end of the pull request description. |
| `with-v` | If true, newly tagged versions will be prefixed with 'v', e.g. 'v1.2.3'. |
| `base-branch` | Whether or not to only consider version tags on the base branch in the pull request. |

### Using Custom Label Names

Expand Down Expand Up @@ -207,6 +208,7 @@ jobs:
release-notes-prefix: ''
release-notes-suffix: ''
with-v: false
base-branch: false
```

Create a CI workflow to run whenever a pull request is merged. All optional inputs are explicitly set to their default values in the configuration below.
Expand Down Expand Up @@ -237,6 +239,7 @@ jobs:
release-notes-prefix: ''
release-notes-suffix: ''
with-v: false
base-branch: false
```

## Contributing
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ inputs:
description: Set to 'true' to prefix versions with 'v'
required: false
default: 'false'
base-branch:
description: Set to 'true' to only consider version tags on the PR base branch. By default considers all version tags in the repository.
required: false
default: 'false'
outputs:
old-version:
description: The version tag prior to bumping
Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function getConfig() {
releaseNotesPrefixPattern: releaseNotesPrefixPattern,
releaseNotesSuffixPattern: releaseNotesSuffixPattern,
requireReleaseNotes: core.getInput('require-release-notes').toLowerCase() === 'true',
baseBranch: core.getInput('base-branch').toLowerCase() === 'true',
v: core.getInput('with-v').toLowerCase() === 'true' ? 'v' : '',
}
}
Expand Down
74 changes: 68 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ async function run() {
await bumpAndTagNewVersion(config)
}
} catch (e) {
core.info(e.stack)
core.setFailed(`unexpected error: ${e.message}`)
}
}
Expand Down
Loading

0 comments on commit d9a5825

Please sign in to comment.