Skip to content

docs(examples): gracefully handle no bump-eligible commits#17

Draft
bearomorphism wants to merge 1 commit intocommitizen-tools:mainfrom
bearomorphism:docs/graceful-no-bump-examples
Draft

docs(examples): gracefully handle no bump-eligible commits#17
bearomorphism wants to merge 1 commit intocommitizen-tools:mainfrom
bearomorphism:docs/graceful-no-bump-examples

Conversation

@bearomorphism
Copy link
Copy Markdown
Collaborator

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:, build(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.yaml and examples/trigger-other-job/.github/workflows/bump-release.yaml so that:

  • The bump step passes --no-raise 21 to cz bump to avoid hard-failing on the no-commits case.
  • It compares HEAD before and after the bump; if unchanged, it logs a message, sets bumped=false and exits 0.
  • The subsequent Build changelog, Release and trigger other workflow steps are guarded by steps.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

  • I have read the contributing guidelines

Was generative AI tooling used to co-author this PR?

  • Yes (please specify the tool below)

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.

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>
@bearomorphism bearomorphism marked this pull request as draft May 8, 2026 08:27
@bearomorphism
Copy link
Copy Markdown
Collaborator Author

draft this and will do a human review later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant