Stop CreateGitHubRelease from firing on preview publishes#384
Merged
Conversation
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>
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.
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:NotFoundException: Not FoundSo
dotnet fallout Publish --publish-to github-packages(the #333 dogfooding) did exactly its job. The job failed onCreateGitHubReleasegetting dragged into the run.Root cause
ICreateGitHubRelease.CreateGitHubReleaseis.TriggeredBy<IPublish>()and was gated only on.OnlyWhenStatic(() => GitRepository.IsOnMainBranch()).Before #333,
Publishran only in the release workflow (its old.Requiresgated onWorkflow == ReleaseWorkflow). #333 replaced that with.Requires(Host is GitHubActions)so the preview/experimental lanes could dogfoodPublish. Because preview pushes tomain, theIsOnMainBranch()gate now passes and a GitHub Release is attempted on every preview push. (Experimental is unaffected — not onmain, so theOnlyWhenskips it.)GitHub Releases are production-only in the channel model.
release.ymlhand-rolls them viagh release create(thepublish-github-releasesjob) and doesn't invoke this C# target at all.Fix
Gate
CreateGitHubReleaseto the release workflow (GitHubActions?.Workflow == ReleaseWorkflow) instead of justIsOnMainBranch(), so it stays dormant on preview/experimental publishes.Validation
dotnet build build/_build.csprojclean. Merging this re-triggers the preview lane onmain, which should now go green (Publish succeeds, CreateGitHubRelease skipped).🤖 Generated with Claude Code