Skip to content

Stop CreateGitHubRelease from firing on preview publishes#384

Merged
ChrisonSimtian merged 1 commit into
mainfrom
bugfix/preview-publish-no-github-release
Jun 14, 2026
Merged

Stop CreateGitHubRelease from firing on preview publishes#384
ChrisonSimtian merged 1 commit into
mainfrom
bugfix/preview-publish-no-github-release

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Problem

The post-merge preview CD on main (from #342) went red. The target summary tells the real story — the feature works, a different target failed:

Target Result
Test ✅ Passed: 470, Skipped: 7
Pack ✅ Packages: 22
Publish 0:07 — pushed 22 packages to GitHub Packages
CreateGitHubRelease NotFoundException: Not Found

So dotnet fallout Publish --publish-to github-packages (the #333 dogfooding) did exactly its job. The job failed on CreateGitHubRelease getting dragged into the run.

Root cause

ICreateGitHubRelease.CreateGitHubRelease is .TriggeredBy<IPublish>() and was gated only on .OnlyWhenStatic(() => GitRepository.IsOnMainBranch()).

Before #333, Publish ran only in the release workflow (its old .Requires gated on Workflow == ReleaseWorkflow). #333 replaced that with .Requires(Host is GitHubActions) so the preview/experimental lanes could dogfood Publish. Because preview pushes to main, the IsOnMainBranch() gate now passes and a GitHub Release is attempted on every preview push. (Experimental is unaffected — not on main, so the OnlyWhen skips it.)

GitHub Releases are production-only in the channel model. release.yml hand-rolls them via gh release create (the publish-github-releases job) and doesn't invoke this C# target at all.

Fix

Gate CreateGitHubRelease to the release workflow (GitHubActions?.Workflow == ReleaseWorkflow) instead of just IsOnMainBranch(), so it stays dormant on preview/experimental publishes.

Validation

dotnet build build/_build.csproj clean. Merging this re-triggers the preview lane on main, which should now go green (Publish succeeds, CreateGitHubRelease skipped).

🤖 Generated with Claude Code

The post-merge preview CD on main went red: `Publish` succeeded (22 packages
pushed to GitHub Packages) but the job failed on `CreateGitHubRelease`, which
threw NotFoundException.

Root cause: `ICreateGitHubRelease.CreateGitHubRelease` is `.TriggeredBy<IPublish>()`
and was gated only on `IsOnMainBranch()`. Before #333, `Publish` ran solely in the
release workflow, so the trigger never fired elsewhere. #333 made the preview and
experimental lanes dogfood `Publish` — and because preview pushes to main, the
IsOnMainBranch gate passed and a GitHub Release was attempted on every preview push.

GitHub Releases are production-only (release.yml hand-rolls them via `gh release
create`; this C# target isn't on the automated release path). Gate the target to the
release workflow so it stays dormant in the preview/experimental lanes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisonSimtian ChrisonSimtian added the target/vCurrent Targets the current version label Jun 14, 2026
@ChrisonSimtian
ChrisonSimtian merged commit e7055d7 into main Jun 14, 2026
1 check passed
@ChrisonSimtian
ChrisonSimtian deleted the bugfix/preview-publish-no-github-release branch June 14, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target/vCurrent Targets the current version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant