jamesfredley opened a new pull request, #15742:
URL: https://github.com/apache/grails-core/pull/15742

   ## Summary
   
   Follow-up to #15741. That PR stopped the `v0.1.0` draft **flood**. This one 
removes the last cosmetic artifact: a release branch with **no published 
release yet** (today `7.2.x`, and any newly-cut branch) still drafts a single 
`v0.1.0`, because release-drafter falls back to its hardcoded default `0.1.0` 
when it finds no "last release".
   
   This change makes such a branch draft its own `vMAJOR.MINOR.0` (e.g. 
`v7.2.0`) instead.
   
   ## How
   
   A small `Seed initial version for release-less branches` step runs before 
release-drafter and decides a `version` input:
   
   - It mirrors release-drafter's own "last release" lookup - a **non-draft** 
release whose `target_commitish` (with `refs/heads/` stripped, as the action 
does) equals the branch, tag starting with `v`, prereleases included.
   - **No matching release** -> pass `version = MAJOR.MINOR.0` (derived from 
the branch name). release-drafter forces that exact version, so the draft 
becomes `v7.2.0`.
   - **Has a release** (7.0.x, 7.1.x, 8.0.x) -> pass an **empty** `version`, 
which release-drafter treats as "no override" - normal next-version resolution 
is completely unchanged.
   
   ### Why it's safe and self-correcting
   
   - Verified against release-drafter v7.3.1 `get-version-info.ts`: 
`versionFromInput = new VersionDescriptor(input.version || ...)`, and the input 
branch is taken only `if (versionFromInput.version)`. An empty string is falsy 
-> falls through to the resolver. A non-empty version sets `no_increment`, so 
`$RESOLVED_VERSION` is exactly the seed.
   - v7.3.1 `action.yml` declares a `version` input.
   - The moment `7.2.x` publishes any release, the lookup finds it and the seed 
goes empty - release-drafter then resolves `7.2.1` normally.
   - Best-effort: any release-list API failure falls back to an empty seed, 
i.e. exactly today's behaviour (no workflow break).
   - release-drafter finds the existing draft by commitish + tag-prefix (not by 
version), so the current `v0.1.0` draft is **re-tagged to `v7.2.0` in place**, 
not duplicated.
   
   The bash logic was unit-tested locally (`7.2.x`->`7.2.0`; 
`7.0.x`/`7.1.x`/`8.0.x`->empty; non-release branch->empty) and `bash -n` clean.
   
   ## Cascade
   
   Lands on `7.0.x`; merge forward into `7.1.x` / `7.2.x` / `8.0.x` in the 
usual cascade.
   
   Assisted-by: claude-code:claude-4.8-opus
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to