Conversation
Foowy
marked this pull request as draft
August 16, 2026 15:44
Foowy
force-pushed
the
fix/publish-nuget-verify-remote-tag
branch
from
August 16, 2026 15:51
2fe4772 to
d3593d0
Compare
…fy remote tag state Follow-up to ShokoAnime#1406. Thanks to revam for flagging that force_push_tag: true works but does so blindly, with no comparison against what the remote tag currently points to — since this repo's checkout intentionally doesn't fetch tag history, there was no way to detect a release tag pointing at an unexpected commit before overwriting it. Two fixes, both additive to the existing rickstaa/action-create-tag step rather than replacing it: - A "Check remote tag state" step runs git ls-remote before the tag step (a lightweight network call, not a history fetch) and only lets the tag step run when the remote either doesn't have the tag yet or already points at the exact commit being published. If it points anywhere else, the job fails loudly instead of the tag step force-overwriting it. - Restore 1:1 parity with the archived brandedoutcast/publish-nuget action, which ShokoAnime#1401 didn't actually achieve: that action queried NuGet.org's own version index up front and skipped pack/push/tag entirely for an already-published version, so an unchanged-version day was a silent no-op. The composite action always ran pack/push/tag unconditionally and relied only on --skip-duplicate to no-op the package push, while the tag step still ran every time regardless — that decoupling is the actual root cause of the Shoko.Abstractions tag conflict across ShokoAnime#1401/ShokoAnime#1405/ShokoAnime#1406. Added a "Check if version is already published" step that queries NuGet.org's flat-container index and gates Pack/Push/Tag on the version being genuinely new. Verified the git ls-remote logic against three simulated cases on a local checkout replicating CI's shallow, tags-excluded actions/checkout@v7 default (new tag, idempotent same-commit rerun, tag pointing at a different commit), and the NuGet.org version-check logic against real data (existing package+version, nonexistent version, nonexistent package/404).
Foowy
force-pushed
the
fix/publish-nuget-verify-remote-tag
branch
from
August 16, 2026 16:03
d3593d0 to
b2842a9
Compare
|
Contributor
Author
|
Superseded by 4f0e3c5 (revam's fix(workflows): fetch tags on checkout and don't error on existing publish tags, pushed directly to master). |
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.



Summary
force_push_tag: truedoes actually work (the force-push branch inaction-create-tag's entrypoint never reads its own local-onlytag_existscheck — it always force-tags+pushes whenforce_push_tagis set), but it does so blindly, with no comparison against what the remote tag currently points to. Since this repo's checkout intentionally doesn't fetch tag history, there was no way to detect if a release tag ever ended up pointing at an unexpected commit (manual retag, a bug elsewhere) — this workflow would silently force it back to the new commit with no warning, masking a real problem instead of surfacing it.rickstaa/action-create-tagstep (kept in place, not replaced): queries the remote tag directly viagit ls-remote(a lightweight network call — no history fetch) and only lets the tag step run when the remote either doesn't have the tag yet or already points at the exact commit being published. If it points anywhere else, the job fails loudly instead of letting the tag step overwrite it.git ls-remote origin "refs/tags/$TAG" "refs/tags/$TAG^{}"returns two lines for an annotated tag (the tag-object SHA and its peeled^{}commit SHA) —tail -1picks the commit SHA in both the annotated and lightweight cases. Verified this against upstream's actualShoko.Abstractions-v6.0.0-alpha.77tag.brandedoutcast/publish-nugetaction, which repo(workflows): replace archived publish-nuget action, resolve Node 20 deprecation #1401 didn't actually achieve: that action queried NuGet.org's own version index up front and skipped pack/push/tag entirely for an already-published version, so an unchanged-version day was a silent no-op. The composite action always ran pack/push/tag unconditionally and relied only ondotnet nuget push --skip-duplicateto no-op the package push, while the tag step still ran every single time regardless — that decoupling is the actual root cause of the wholeShoko.Abstractions-v6.0.0-alpha.77tag conflict across repo(workflows): replace archived publish-nuget action, resolve Node 20 deprecation #1401/fix(workflows): don't fail nuget publish when release tag already exists #1405/fix(workflows): force-push the release tag on nuget publish #1406. Added a "Check if version is already published" step that querieshttps://api.nuget.org/v3-flatcontainer/{packageId}/index.jsonand gates Pack/Push/Tag on the version being genuinely new — matching the old action's behavior instead of approximating it.git ls-remotetag check stays as a second line of defense on top of the NuGet.org gate — it still protects the tag from being clobbered even on an unexpected rerun.Test plan
git ls-remoteresolution logic against three simulated cases on a local checkout that exactly replicates CI's shallow, tags-excludedactions/checkout@v7default: a brand-new tag (creates+pushes, exit 0), an idempotent same-commit rerun (skips cleanly, exit 0), and a tag pointing at a different commit (fails loudly, remote tag confirmed unmoved)shoko.abstractions/6.0.0-alpha.77, found), a nonexistent version (not found), and a nonexistent package (404, handled explicitly)mastercompletes the publish jobs successfully (idempotent re-publish case, unchanged version)