Skip to content

feat: add stable graduation output and logic for release stability#152

Merged
goosewobbler merged 3 commits intomainfrom
fix-gate-preview
Apr 22, 2026
Merged

feat: add stable graduation output and logic for release stability#152
goosewobbler merged 3 commits intomainfrom
fix-gate-preview

Conversation

@goosewobbler
Copy link
Copy Markdown
Owner

No description provided.

…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.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

Release Preview — 4 packages

Scope: @releasekit/*

This PR is labeled for a patch release.

This PR will trigger the following release when merged:

Packages

Package Version
@releasekit/notes 0.17.1
@releasekit/publish 0.17.1
@releasekit/release 0.17.1
@releasekit/version 0.17.1

Changelog

Project-wide changes

Added

  • add gate-stable output for release stability indication (action)
  • add stable graduation output and logic for release stability (release)

Fixed

  • improve error handling for scope labels in label mode (release)
@releasekit/notes releasekit-notes-v0.17.0 → 0.17.1

Changed

  • Update version to 0.17.1
@releasekit/publish releasekit-publish-v0.17.0 → 0.17.1

Changed

  • Update version to 0.17.1
@releasekit/release releasekit-release-v0.17.0 → 0.17.1

Added

  • add stable graduation output and logic for release stability (release)

Fixed

  • improve error handling for scope labels in label mode (release)
@releasekit/version releasekit-version-v0.17.0 → 0.17.1

Changed

  • Update version to 0.17.1

Tags

  • releasekit-notes-v0.17.1
  • releasekit-publish-v0.17.1
  • releasekit-release-v0.17.1
  • releasekit-version-v0.17.1

Updated automatically by ReleaseKit

@goosewobbler goosewobbler changed the title Fix gate preview feat: add stable graduation output and logic for release stability Apr 22, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 22, 2026

Greptile Summary

This PR adds a gate-stable output to the gate mode, exposing whether the release should be a stable graduation (release:stable label present without release:prerelease). It also fixes a bug in preview.ts where label-mode runs with no release-triggering labels would incorrectly throw "No scope specified" even though no release would actually happen.

Confidence Score: 5/5

Safe to merge — changes are well-scoped, backward-compatible, and covered by new tests.

All findings are P2 or absent. The stable field is optional in the interface so early-return paths that omit it default safely to false in the output writer. The willRelease guard in preview.ts correctly preserves existing behavior for commit mode and bump-label-present label mode while fixing the false-positive scope error. Tests cover the key branches.

No files require special attention.

Important Files Changed

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]
Loading

Reviews (1): Last reviewed commit: "feat(action): add gate-stable output for..." | Re-trigger Greptile

@goosewobbler goosewobbler added bump:patch Release a patch version scope:all Release all packages labels Apr 22, 2026
@goosewobbler goosewobbler merged commit 87e05d0 into main Apr 22, 2026
22 of 24 checks passed
@goosewobbler goosewobbler deleted the fix-gate-preview branch April 22, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump:patch Release a patch version scope:all Release all packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant