From 3bae09f3e39927f94190aac6761af6aebd039bf7 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Fri, 26 Jun 2026 14:08:26 -0700 Subject: [PATCH 1/3] TEMP: nbgv ref-handling probe (do not merge) Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/zz-nbgv-probe.yml | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/zz-nbgv-probe.yml diff --git a/.github/workflows/zz-nbgv-probe.yml b/.github/workflows/zz-nbgv-probe.yml new file mode 100644 index 0000000..9cba82a --- /dev/null +++ b/.github/workflows/zz-nbgv-probe.yml @@ -0,0 +1,35 @@ +name: NBGV ref probe + +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + probe: + name: Probe nbgv ref handling + strategy: + fail-fast: false + matrix: + branch: [ main, develop ] + ignore: [ 'true', 'false' ] + runs-on: ubuntu-latest + steps: + - name: Setup .NET SDK step + uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 + with: + dotnet-version: 10.x + - name: Checkout code step + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + ref: ${{ matrix.branch }} + fetch-depth: 0 + - name: Run nbgv action step + id: nbgv + uses: dotnet/nbgv@master + env: + IGNORE_GITHUB_REF: ${{ matrix.ignore }} + - name: Report step + run: | + echo "PROBE-RESULT branch=${{ matrix.branch }} ignore=${{ matrix.ignore }} PublicRelease=${{ steps.nbgv.outputs.PublicRelease }} SemVer2=${{ steps.nbgv.outputs.SemVer2 }}" From 57105690026364af264f1b2e4d3669f42348f536 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Fri, 26 Jun 2026 14:09:06 -0700 Subject: [PATCH 2/3] TEMP: probe on push trigger --- .github/workflows/zz-nbgv-probe.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/zz-nbgv-probe.yml b/.github/workflows/zz-nbgv-probe.yml index 9cba82a..31ee6de 100644 --- a/.github/workflows/zz-nbgv-probe.yml +++ b/.github/workflows/zz-nbgv-probe.yml @@ -1,7 +1,8 @@ name: NBGV ref probe on: - workflow_dispatch: + push: + branches: [ fix/nbgv-ignore-github-ref ] permissions: contents: read From 30ee51551e47169011ce081e522864cd4c23c996 Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Fri, 26 Jun 2026 14:12:25 -0700 Subject: [PATCH 3/3] Fix develop prerelease tagging: IGNORE_GITHUB_REF, not a GITHUB_REF override 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) --- .github/workflows/build-nugetlibrary-task.yml | 1 - .github/workflows/build-release-task.yml | 1 - .github/workflows/get-version-task.yml | 15 +++----- .github/workflows/zz-nbgv-probe.yml | 36 ------------------- 4 files changed, 5 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/zz-nbgv-probe.yml diff --git a/.github/workflows/build-nugetlibrary-task.yml b/.github/workflows/build-nugetlibrary-task.yml index 0fb70e2..cac4dd5 100644 --- a/.github/workflows/build-nugetlibrary-task.yml +++ b/.github/workflows/build-nugetlibrary-task.yml @@ -37,7 +37,6 @@ jobs: secrets: inherit with: ref: ${{ inputs.ref }} - branch: ${{ inputs.branch }} build-nugetlibrary: name: Build NuGet library project job diff --git a/.github/workflows/build-release-task.yml b/.github/workflows/build-release-task.yml index 6633ec5..3d1049d 100644 --- a/.github/workflows/build-release-task.yml +++ b/.github/workflows/build-release-task.yml @@ -50,7 +50,6 @@ jobs: secrets: inherit with: ref: ${{ inputs.ref }} - branch: ${{ inputs.branch }} # Entry gate: validate branch<->version consistency once, before the build jobs, so an NBGV mis-classification fails # fast instead of after building and publishing. main must be a public release (no prerelease '-'); every other branch diff --git a/.github/workflows/get-version-task.yml b/.github/workflows/get-version-task.yml index 7a3bb08..c478dbb 100644 --- a/.github/workflows/get-version-task.yml +++ b/.github/workflows/get-version-task.yml @@ -9,12 +9,6 @@ on: required: false type: string default: '' - # Logical branch NBGV classifies against. Pins PublicRelease to this branch instead of the runner's GITHUB_REF, - # which on a publish dispatched from the default branch is that branch for every matrix leg. Empty keeps GITHUB_REF. - branch: - required: false - type: string - default: '' outputs: SemVer2: value: ${{ jobs.get-version.outputs.SemVer2 }} @@ -59,7 +53,8 @@ jobs: id: nbgv uses: dotnet/nbgv@master env: - # NBGV reads the branch from GITHUB_REF; pin it to the leg being versioned so a publish dispatched from the - # default branch doesn't classify every leg as the public ref and strip its prerelease suffix. - GITHUB_REF: ${{ inputs.branch != '' && format('refs/heads/{0}', inputs.branch) || github.ref }} - GITHUB_REF_NAME: ${{ inputs.branch != '' && inputs.branch || github.ref_name }} + # NBGV's GitHub Actions cloud-build provider overrides the checked-out branch with GITHUB_REF (the dispatch + # ref). On a publish dispatched from the default branch that misclassifies every matrix leg as the public ref + # and strips the prerelease suffix. GITHUB_REF is reserved and cannot be reliably overridden, so tell NBGV to + # ignore it and version from the actually-checked-out branch (each leg checks out its own branch). + IGNORE_GITHUB_REF: true diff --git a/.github/workflows/zz-nbgv-probe.yml b/.github/workflows/zz-nbgv-probe.yml deleted file mode 100644 index 31ee6de..0000000 --- a/.github/workflows/zz-nbgv-probe.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: NBGV ref probe - -on: - push: - branches: [ fix/nbgv-ignore-github-ref ] - -permissions: - contents: read - -jobs: - probe: - name: Probe nbgv ref handling - strategy: - fail-fast: false - matrix: - branch: [ main, develop ] - ignore: [ 'true', 'false' ] - runs-on: ubuntu-latest - steps: - - name: Setup .NET SDK step - uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 - with: - dotnet-version: 10.x - - name: Checkout code step - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - with: - ref: ${{ matrix.branch }} - fetch-depth: 0 - - name: Run nbgv action step - id: nbgv - uses: dotnet/nbgv@master - env: - IGNORE_GITHUB_REF: ${{ matrix.ignore }} - - name: Report step - run: | - echo "PROBE-RESULT branch=${{ matrix.branch }} ignore=${{ matrix.ignore }} PublicRelease=${{ steps.nbgv.outputs.PublicRelease }} SemVer2=${{ steps.nbgv.outputs.SemVer2 }}"