Description
Following the rollout of the PR bump preview pattern across three repos (#1510), the workflow is currently duplicated in three places:
commitizen-tools/commitizen/.github/workflows/pr-bump-preview.yml
commitizen-tools/commitizen-action/.github/workflows/pr-bump-preview.yml
commitizen-tools/setup-cz/examples/pr-bump-preview.yaml (copy-paste source for end users)
The recent security fix (same-repo guard + persist-credentials: false) had to be applied to all three copies independently. Future maintenance — new actions/checkout versions, comment-action upgrades, additional flags — will incur the same per-repo cost.
Possible Solution
Promote the example into a reusable workflow hosted in commitizen-tools/setup-cz.
Files
- New
setup-cz/.github/workflows/pr-bump-preview.yml with on: workflow_call and inputs:
cz-version (default latest) → forwarded to setup-cz
extra-requirements (default empty) → forwarded to setup-cz
ref (optional) → checkout ref override
examples/pr-bump-preview-wrapper.yaml shrinks to a thin wrapper showing uses: commitizen-tools/setup-cz/.github/workflows/pr-bump-preview.yml@v1.
Consumer wrapper (~8 lines)
on:
pull_request_target:
types: [opened, reopened, synchronize, ready_for_review]
permissions: { contents: read, pull-requests: write }
jobs:
preview:
uses: commitizen-tools/setup-cz/.github/workflows/pr-bump-preview.yml@v1
Migration
After this lands and a setup-cz release is cut:
- This repo: replace the 80-line workflow with the 8-line wrapper.
commitizen-tools/commitizen-action: same.
Why a reusable workflow (not a composite action)?
A composite action would still need every consumer to write the pull_request_target trigger, the same-repo guard, the checkout, and the comment-posting step. Those are the exact bits we want to deduplicate. Reusable workflows encapsulate the whole job.
Why now wasn't the right time
Doing this in the original three PRs was rejected to avoid cross-repo merge coordination and to gather data on what inputs actually matter. Once the workflow has run on a few real PRs, we'll know whether working-directory, cz-version overrides, etc. are actually needed before committing them to a public reusable-workflow contract.
Additional context
Mirrors commitizen-tools/setup-cz#20 so this work item is also tracked here for visibility alongside the original feature request.
Acceptance:
Related issues
Description
Following the rollout of the PR bump preview pattern across three repos (#1510), the workflow is currently duplicated in three places:
commitizen-tools/commitizen/.github/workflows/pr-bump-preview.ymlcommitizen-tools/commitizen-action/.github/workflows/pr-bump-preview.ymlcommitizen-tools/setup-cz/examples/pr-bump-preview.yaml(copy-paste source for end users)The recent security fix (same-repo guard +
persist-credentials: false) had to be applied to all three copies independently. Future maintenance — newactions/checkoutversions, comment-action upgrades, additional flags — will incur the same per-repo cost.Possible Solution
Promote the example into a reusable workflow hosted in
commitizen-tools/setup-cz.Files
setup-cz/.github/workflows/pr-bump-preview.ymlwithon: workflow_calland inputs:cz-version(defaultlatest) → forwarded tosetup-czextra-requirements(default empty) → forwarded tosetup-czref(optional) → checkout ref overrideexamples/pr-bump-preview-wrapper.yamlshrinks to a thin wrapper showinguses: commitizen-tools/setup-cz/.github/workflows/pr-bump-preview.yml@v1.Consumer wrapper (~8 lines)
Migration
After this lands and a setup-cz release is cut:
commitizen-tools/commitizen-action: same.Why a reusable workflow (not a composite action)?
A composite action would still need every consumer to write the
pull_request_targettrigger, the same-repo guard, the checkout, and the comment-posting step. Those are the exact bits we want to deduplicate. Reusable workflows encapsulate the whole job.Why now wasn't the right time
Doing this in the original three PRs was rejected to avoid cross-repo merge coordination and to gather data on what inputs actually matter. Once the workflow has run on a few real PRs, we'll know whether
working-directory,cz-versionoverrides, etc. are actually needed before committing them to a public reusable-workflow contract.Additional context
Mirrors
commitizen-tools/setup-cz#20so this work item is also tracked here for visibility alongside the original feature request.Acceptance:
setup-cz/.github/workflows/pr-bump-preview.ymlexamples/pr-bump-preview-wrapper.yamlcommitizen-tools/commitizen-actionswapping the workflow for the wrapperRelated issues