docs(examples): gracefully handle no bump-eligible commits#16
Closed
bearomorphism wants to merge 1 commit intocommitizen-tools:mainfrom
Closed
docs(examples): gracefully handle no bump-eligible commits#16bearomorphism wants to merge 1 commit intocommitizen-tools:mainfrom
bearomorphism wants to merge 1 commit intocommitizen-tools:mainfrom
Conversation
Update both bump-release.yaml examples so that pushing only commits which do not trigger a version bump (e.g. docs:, ci:, build(deps):) does not fail the workflow with exit code 21. The bump step now passes `--no-raise 21` to cz bump and detects whether HEAD changed; if not, it sets `bumped=false` and exits 0. Subsequent steps (changelog, release, trigger-other-workflow) are guarded by `steps.bump-version.outputs.bumped == 'true'` so they are skipped on no-op runs. This mirrors the same pattern already used in commitizen's own bumpversion.yml workflow (see commitizen-tools/commitizen#1950). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to commitizen-tools/commitizen#1950 (suggested in this comment).
When users copy-paste these example workflows and only push commits that do not trigger a version bump (e.g. docs:, ci:, �uild(deps):), cz bump --yes exits with code
21(NO_COMMITS_TO_BUMP), which causes the entire workflow to fail.This PR updates both
examples/bump-release.yamlandexamples/trigger-other-job/.github/workflows/bump-release.yamlso that:--no-raise 21tocz bumpto avoid hard-failing on the no-commits case.HEADbefore and after the bump; if unchanged, it logs a message, setsbumped=falseand exits0.Build changelog,Releaseandtrigger other workflowsteps are guarded bysteps.bump-version.outputs.bumped == 'true'so they are skipped on no-op runs.This mirrors the same pattern that commitizen itself adopted in its own bumpversion workflow.
Checklist
Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot
Expected Behavior
Users who copy-paste these examples now get a workflow that succeeds gracefully when only non-bump-eligible commits are pushed, instead of one that fails with exit code 21.