Fix develop prerelease tagging: IGNORE_GITHUB_REF (supersedes the GITHUB_REF override)#198
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…verride The #196 re-sync (template #215) tried to restore the develop leg's prerelease tag by overriding GITHUB_REF in the nbgv step env. That is ineffective: GITHUB_REF is a reserved GitHub variable a step-level env cannot reliably override, so NBGV's GitHub Actions cloud-build provider still read the dispatch ref (main) as BuildingRef and classified every matrix leg as the public ref. NBGV computes the version from the checked-out branch history; its cloud-build provider only overrides that with GITHUB_REF. Set IGNORE_GITHUB_REF=true so NBGV ignores the CI ref and versions from the actually-checked-out branch (each leg already checks out its own branch). Verified in CI (dotnet/nbgv action): - checkout develop, IGNORE_GITHUB_REF=true -> PublicRelease=False, 1.4.2-g14f645dfd9 - checkout main, IGNORE_GITHUB_REF=true -> PublicRelease=True, 1.4.3 - checkout main, IGNORE_GITHUB_REF=false -> suffix (reproduces the bug) Removes the now-unused branch input/threading added for the GITHUB_REF override; the validate-release entry gate stays as the backstop. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect version classification in the release workflows by switching the NBGV GitHub Actions integration from an ineffective GITHUB_REF override approach to using NBGV’s dedicated “ignore GitHub ref” mechanism, and removes now-unneeded branch threading into the version task.
Changes:
- Update the versioning task to ignore
GITHUB_REFand derive versioning from the checked-out ref instead. - Remove the
branchinput pass-through from workflows that call the version task.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/get-version-task.yml | Switch NBGV behavior to ignore the runner ref and version from the checked-out ref (and remove the now-unused branch input). |
| .github/workflows/build-release-task.yml | Stop passing branch into the version task since the version task no longer accepts/needs it. |
| .github/workflows/build-nugetlibrary-task.yml | Stop passing branch into the version task since the version task no longer accepts/needs it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The release-workflow re-sync (#196, template ProjectTemplate#215) tried to restore the develop leg's dropped prerelease tag by overriding
GITHUB_REFin the nbgv step env. The first real publish after it landed proved that's ineffective: the develop leg still published a clean version (validate-releasecorrectly blocked it).Root cause (from NBGV source + CI logs): NBGV's GitHub Actions cloud-build provider reads
GITHUB_REF, butGITHUB_REFis a reserved GitHub variable a step-levelenv:cannot reliably override — the runner re-injects the dispatch ref. CI evidence: the step env showedGITHUB_REF=refs/heads/develop, yet NBGV reported"BuildingRef": "refs/heads/main"→PublicRelease=true→ clean1.4.2.Fix
NBGV versions from the checked-out branch history; its cloud-build provider only overrides that with
GITHUB_REF. Set NBGV's ownIGNORE_GITHUB_REF=trueso it ignores the CI ref and uses the actually-checked-out branch — each matrix leg already checks out its own branch (Switched to a new branch 'develop').Also removes the now-unused
branchinput/threading that existed only for theGITHUB_REFoverride. Thevalidate-releaseentry gate stays as the backstop.Verified in CI (probe with the real
dotnet/nbgvaction)IGNORE_GITHUB_REFPublicReleaseSemVer21.4.2-g14f645dfd9(prerelease ✅)1.4.3(stable ✅)1.4.3-g…(bug reproduced)🤖 Generated with Claude Code