feat: add stable graduation output and logic for release stability#152
feat: add stable graduation output and logic for release stability#152goosewobbler merged 3 commits intomainfrom
Conversation
…bility - Introduced a new output `gate-stable` in action.yml to indicate if the release should be a stable graduation. - Updated the GateOutput interface to include a `stable` boolean property. - Enhanced the runGate function to determine stability based on presence of `release:stable` and `release:prerelease` labels. - Added unit tests to validate the new stable logic and its precedence over bump labels.
- Updated the logic in applyLabelOverrides to only require a scope target when a release is triggered, allowing for smoother operation in label mode without bump labels. - Enhanced unit tests to cover new scenarios, ensuring no errors are thrown when no scope label is matched and no target is provided in label mode, while still enforcing checks when a release is expected.
- Introduced a new output `gate-stable` in the `writeGateOutputs` function to indicate whether the release is stable based on the parsed input. - This enhancement aligns with the recent updates to support stable graduation logic in the release process.
Release Preview — 4 packages
This PR will trigger the following release when merged: Packages
ChangelogProject-wide changesAdded
Fixed
@releasekit/notes releasekit-notes-v0.17.0 → 0.17.1Changed
@releasekit/publish releasekit-publish-v0.17.0 → 0.17.1Changed
@releasekit/release releasekit-release-v0.17.0 → 0.17.1Added
Fixed
@releasekit/version releasekit-version-v0.17.0 → 0.17.1Changed
Tags
Updated automatically by ReleaseKit |
Greptile SummaryThis PR adds a Confidence Score: 5/5Safe to merge — changes are well-scoped, backward-compatible, and covered by new tests. All findings are P2 or absent. The No files require special attention.
|
| Filename | Overview |
|---|---|
| packages/release/src/gate.ts | Adds stable field to GateOutput; computes isStable = hasStableLabel && !hasPrereleaseLabel in label mode; propagates stable: false through early-return conflict paths. Logic is correct. |
| packages/release/src/preview.ts | Wraps scope-required error in a willRelease guard so label mode with no bump/stable labels no longer throws when no target is configured. Logic correctly handles commit mode (always requires scope) and label mode (only requires scope when a release will actually happen). |
| scripts/run-action.mjs | Adds gate-stable output ('true'/'false') derived from the parsed gate JSON; consistent with pattern used for should-release. |
| action.yml | Declares new gate-stable output mapping to the step's gate-stable output variable. |
| packages/release/test/unit/gate.spec.ts | Adds four new test cases covering stable: true (stable-only label), stable: false (patch-only), stable: true (stable + patch), and stable: false (prerelease conflict). |
| packages/release/test/unit/preview.spec.ts | Renames commit-mode test to clarify trigger; adds two new label-mode tests: no-release-labels skips without error, and bump-label-present still throws scope error. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[runGate] --> B{bumpConflict or\nprereleaseConflict?}
B -- Yes --> C[return shouldRelease:false\nstable:false\nblocked:true]
B -- No --> D{releaseTrigger?}
D -- label --> E{hasBumpLabel or\nhasStableLabel?}
E -- Yes --> F[shouldRelease = true\nisStable = hasStableLabel && !hasPrereleaseLabel]
E -- No --> G[shouldRelease = false]
D -- commit --> H[shouldRelease based\non skip label]
F --> I{skipPattern match?}
H --> I
G --> J[return stable:isStable=false]
I -- Yes --> K[shouldRelease = false\nisStable unchanged]
I -- No --> L[return stable:isStable]
K --> L
M[applyLabelOverrides in preview.ts] --> N{matchedScopePatterns > 0?}
N -- Yes --> O[result.target = patterns]
N -- No --> P{options.target set?}
P -- Yes --> Q[continue]
P -- No --> R{willRelease?\ntrigger≠label OR\npatch/minor/major/stable label present}
R -- Yes --> S[throw: No scope specified]
R -- No --> T[skip error — no release will happen]
Reviews (1): Last reviewed commit: "feat(action): add gate-stable output for..." | Re-trigger Greptile
No description provided.