feat: make release label optional#9
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an option to make “release label required” configurable for the Release Champion GitHub Action, allowing releases to be gated by a label only when explicitly enabled.
Changes:
- Add a new
require-release-labelinput and plumb it through the composite action environment. - Update phase-detection logic to create release PRs on every merged PR when the label requirement is disabled.
- Refresh README guidance and examples to document the new optional label gating.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
scripts/main.sh |
Adds conditional logic to bypass label checks when require-release-label is not enabled. |
action.yml |
Introduces require-release-label input and exports it to the runtime environment. |
README.md |
Updates usage/docs to reflect optional label gating and adds configuration examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| require-release-label: | ||
| description: 'Require the release label to trigger a release PR. When false, every merged PR triggers a release.' | ||
| required: false | ||
| default: 'false' |
There was a problem hiding this comment.
require-release-label defaults to false, which changes the action’s default behavior from “only labeled PRs create a release PR” to “every merged PR creates a release PR”. To avoid a breaking change for existing users on @v1, consider defaulting this input to true (preserve prior behavior) and let users opt out, or publish this under a new major version and call out the breaking change prominently.
| default: 'false' | |
| default: 'true' |
| release-label: | ||
| description: 'Label that marks a PR for release' | ||
| required: false | ||
| default: 'change-release' | ||
| require-release-label: | ||
| description: 'Require the release label to trigger a release PR. When false, every merged PR triggers a release.' |
There was a problem hiding this comment.
The release-label input description still implies the label controls releases unconditionally, but with require-release-label it’s only used when the requirement is enabled. Update this description to match the new semantics so the action metadata (Marketplace / action.yml) doesn’t contradict the README.
| echo "Release label not required — creating release PR" | ||
| bash "$SCRIPT_DIR/create-release-pr.sh" | ||
|
|
||
| elif echo "$PR_LABELS" | tr ',' '\n' | grep -qx "$INPUT_RELEASE_LABEL"; then |
There was a problem hiding this comment.
Label matching uses grep -qx, which treats INPUT_RELEASE_LABEL as a regex. If a label name contains regex metacharacters, this can produce incorrect matches. Use fixed-string matching (e.g., grep -F) so the label is matched literally.
| elif echo "$PR_LABELS" | tr ',' '\n' | grep -qx "$INPUT_RELEASE_LABEL"; then | |
| elif echo "$PR_LABELS" | tr ',' '\n' | grep -Fqx "$INPUT_RELEASE_LABEL"; then |
| elif [[ "${INPUT_REQUIRE_RELEASE_LABEL:-false}" != "true" ]]; then | ||
| # Phase 1: Label not required — every merged PR triggers a release | ||
| echo "Release label not required — creating release PR" | ||
| bash "$SCRIPT_DIR/create-release-pr.sh" |
There was a problem hiding this comment.
The new require-release-label branching changes the phase-detection logic but there are no automated tests covering scripts/main.sh behavior. Since the repo already uses Bats, consider adding a small Bats test suite for main.sh to assert the action triggers/releases correctly when require-release-label is true vs false and when the PR is a release/* branch.
No description provided.