Repository navigation
release event triggers with an empty github.ref, silently skipping sign/release jobs (broke 10.1.0 and 10.1.1 publishing) #495
Description
Summary
The last two releases (10.1.0 and 10.1.1) failed to publish signed NuGet packages because the sign and release jobs in build-library.yml and build-template.yml were silently skipped — not failed — on the release: published trigger.
Root cause
Both jobs gate on github.ref:
sign: if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
release: if: ${{ startsWith(github.ref, 'refs/tags/') }}On run 28783150142 (the 10.1.1 release), $GITHUB_REF was empty in the build job (verified byte-for-byte in the raw log), even though GitHub's docs state GITHUB_REF for a release event should be refs/tags/<tag_name>.
This isn't a one-off: the 10.1.0 release (27936434216) hit the identical bug on build-template.yml. Releases before that (10.0.1 and earlier) worked correctly — github.ref genuinely resolved to the tag. The regression's timing lines up with GitHub's June 18, 2026 "Control who and what triggers GitHub Actions workflows" change, though this couldn't be fully confirmed without org-admin access to check for enterprise/org rulesets. Notably, every release in this repo tags the exact tip of main, which may be a contributing factor to whatever ambiguity is being hit.
Impact
10.1.0: library packages were manually recovered viaworkflow_dispatch(ref=10.1.0), butCommunityToolkit.Datasync.Server.Template.CSharpnever published — nuget.org is still stuck at10.0.1for the template package.10.1.1: both library and template packages were skipped; being manually recovered viaworkflow_dispatchonref=10.1.1(see recent runs).- The attempted manual recovery for
10.1.0's template package also surfaced a second, unrelated issue: the oldNUGET_PACKAGE_PUSH_TOKEN-based push started failing with a 403 (expired/invalid key), which is what motivated the move to NuGet Trusted Publishing in build: enable NuGet trusted publishing for release workflows #494/Enable Trusted Publishing #486.
Recommended fix
In both build-library.yml and build-template.yml:
- Stop gating
sign/releaseongithub.refstring matching. Use the triggering event instead, which doesn't depend on ref resolution:(Leavesign: if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'release' }} release: if: ${{ github.event_name == 'release' }}
workflow_dispatchworking as-is for manual recovery.) - Stop relying on
$env:GITHUB_REFintools/GetBuildVersion.psm1forreleaseevents. Passgithub.event.release.tag_nameexplicitly (e.g., buildVersionStringasrefs/tags/${{ github.event.release.tag_name }}whengithub.event_name == 'release', else fall back to$env:GITHUB_REF), so a blank ref can't silently produce a wrong package version even if the gating logic is fixed. - Fail loudly instead of skipping silently. Add a guard step in
release(gated ongithub.event_name == 'release') that assertsgithub.ref_name == github.event.release.tag_nameand emits::error::+ exits non-zero if not — turning this into a visible red ❌ instead of a quiet "skipped" that went unnoticed for a week last time. - Optional: a scheduled workflow that compares the latest git tag to the latest published NuGet.org version and opens an issue on drift, to catch this class of failure automatically.
- Optional: file a GitHub Support ticket / community discussion referencing runs
28783150142and27936434216as evidence, since an emptyGITHUB_REFforreleaseevents contradicts documented platform behavior.
Known gap (accepted)
CommunityToolkit.Datasync.Server.Template.CSharp@10.1.0 will remain unpublished on nuget.org. Backfilling it isn't a simple re-dispatch, since workflow_dispatch on ref=10.1.0 would run the pre-OIDC workflow (same expired-token 403). Decided to leave this gap rather than rotate the old token for a superseded version.
Activity
adrianhall commentedon Jul 6, 2026
Note to self: by way of test, we will release 10.1.2 to test the release.
fix: stop gating sign/release jobs and package version on github.ref …