From 1ced8e44565360b13f47c8c9cbf3990ddc64e338 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sun, 16 Aug 2026 18:42:11 -0700 Subject: [PATCH 1/2] Drop IGNORE_GITHUB_REF From the Hosted Get-Version Task WORKFLOW.md D3.1 states the current model: each run builds and versions the one branch it was triggered on, GITHUB_REF names it, NBGV classifies it directly, and no IGNORE_GITHUB_REF override is required. The hosted get-version-task.yml carried the override from the retired branch-matrix snippet while the inline get-version in build-release-task.yml followed D3.1, and #768's review raised the difference. The task now follows the same rule as its sibling, and its comments say why. --- .github/workflows/get-version-task.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/get-version-task.yml b/.github/workflows/get-version-task.yml index 5ed8c123..81c50816 100644 --- a/.github/workflows/get-version-task.yml +++ b/.github/workflows/get-version-task.yml @@ -3,10 +3,9 @@ name: Get version information task # The fleet's single NBGV run, hosted here once and reached by a leaf or a publisher through a pinned uses:. # It has no repo-specific line, since version.json and the git history it walks are the only per-repo input. # Every caller reads the same five outputs plus the derived Prerelease flag. -# The ref input defaults to the caller's own checkout ref. -# A caller may pass a different ref, for example a publisher versioning a branch other than the one it dispatched from. -# IGNORE_GITHUB_REF below keeps NBGV honest even when inputs.ref and github.ref disagree. -# That check costs nothing on the common path where the two already match. +# The ref input defaults to the caller's own checkout ref, and each run versions the one branch it was triggered on. +# NBGV classifies that branch from GITHUB_REF directly, with no IGNORE_GITHUB_REF override, per WORKFLOW.md D3.1. +# A caller passing a commit rather than a branch as ref still classifies against the branch it dispatched from, which is the branch that commit belongs to. # AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion are exposed for a .NET build to stamp. # A caller with no compiled code, a PyPI or HACS package, simply leaves them unused rather than the task growing a per-ecosystem branch. # Prerelease is a real derivation two callers duplicated identically, a Python package and a Home Assistant integration, neither versioning a .NET assembly. @@ -71,13 +70,6 @@ jobs: - name: Run Nerdbank.GitVersioning tool step id: nbgv uses: dotnet/nbgv@master - env: - # Version from the checked-out branch rather than the CI ref. - # GITHUB_REF is reserved and a step env can't reliably override it, since the runner re-injects the dispatch ref. - # On a publish dispatched from the default branch, NBGV would therefore classify every leg as the public ref. - # IGNORE_GITHUB_REF makes NBGV ignore GITHUB_REF and use the checked-out branch, which each caller already is. - # The validate-release gate backstops any misclassification. - IGNORE_GITHUB_REF: "true" # NBGV's PrereleaseVersion output only carries version.json's `-tag` segment, empty for a bare SemVer base. # The auto-appended -g{sha} segment lives in SemVer2 but is not exposed there. From b515376e3770f74ddde86e1f6d566af11221bbb6 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sun, 16 Aug 2026 18:46:18 -0700 Subject: [PATCH 2/2] State That Classification Follows the Trigger Ref --- .github/workflows/get-version-task.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get-version-task.yml b/.github/workflows/get-version-task.yml index 81c50816..8c4ae2bf 100644 --- a/.github/workflows/get-version-task.yml +++ b/.github/workflows/get-version-task.yml @@ -5,7 +5,7 @@ name: Get version information task # Every caller reads the same five outputs plus the derived Prerelease flag. # The ref input defaults to the caller's own checkout ref, and each run versions the one branch it was triggered on. # NBGV classifies that branch from GITHUB_REF directly, with no IGNORE_GITHUB_REF override, per WORKFLOW.md D3.1. -# A caller passing a commit rather than a branch as ref still classifies against the branch it dispatched from, which is the branch that commit belongs to. +# Classification follows the trigger ref whatever ref the caller checks out, so a caller passing a commit or another branch as ref gets that tree's height under the trigger branch's classification, never a different branch's. # AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion are exposed for a .NET build to stamp. # A caller with no compiled code, a PyPI or HACS package, simply leaves them unused rather than the task growing a per-ecosystem branch. # Prerelease is a real derivation two callers duplicated identically, a Python package and a Home Assistant integration, neither versioning a .NET assembly.