Skip to content

fix(workflows): don't fail nuget publish when release tag already exists - #1405

Merged
harshithmohan merged 1 commit into
ShokoAnime:masterfrom
Foowy:fix/publish-nuget-tag-exists
Aug 16, 2026
Merged

harshithmohan merged 1 commit into
ShokoAnime:masterfrom
Foowy:fix/publish-nuget-tag-exists

Conversation

@Foowy

@Foowy Foowy commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Test plan

The daily build republishes packages whose version wasn't bumped since
the last successful run. dotnet nuget push --skip-duplicate already
tolerates this for the package itself, but rickstaa/action-create-tag
was still hard-failing every Publish *Nuget job on reruns because the
git tag from the prior publish already exists.
@Foowy
Foowy force-pushed the fix/publish-nuget-tag-exists branch from a668fa5 to 9385c09 Compare August 16, 2026 09:25
@Foowy
Foowy marked this pull request as ready for review August 16, 2026 09:25
@harshithmohan
harshithmohan merged commit 7e872a3 into ShokoAnime:master Aug 16, 2026
3 checks passed
@sonarqubecloud

Copy link
Copy Markdown

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

harshithmohan pushed a commit that referenced this pull request Aug 16, 2026
#1405's tag_exists_error: false never took effect: action-create-tag's
existence check is git tag -l, a local check, but the daily-build
runner does a fresh checkout with no tags fetched — it always sees
'not exists' locally and tries to create+push the tag fresh, which the
remote then rejects since the tag is already there. force_push_tag
force-pushes unconditionally, which is a no-op when the tag already
points at the same commit.
@Foowy
Foowy deleted the fix/publish-nuget-tag-exists branch August 16, 2026 09:41
Foowy added a commit to Foowy/ShokoServer that referenced this pull request Aug 16, 2026
…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:

- Replace the rickstaa/action-create-tag step with inline git ls-remote
  logic: query the remote tag directly (a lightweight network call, no
  history fetch) and only skip/create the tag when the remote either
  doesn't have it yet or already points at the exact commit being
  published. Fail loudly instead of overwriting if it points anywhere
  else.

- 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 added a commit to Foowy/ShokoServer that referenced this pull request Aug 16, 2026
…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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants