feat(ci): teach [GitHubActions] about CheckoutRef so regen preserves the ref pin#175
Merged
Merged
Conversation
…the ref pin The ubuntu-latest workflow YAML carried a manual ref:github.head_ref patch that keeps HEAD attached on PR-triggered builds. Without it, GitHubTasksTest.GitHubRepositoryFromLocalDirectoryTest fails because GitRepository.FromLocalDirectory can't resolve a branch from a detached merge SHA (seen on PR #172 when GenerateTools clobbered the patch and CI went red). Fix: surface the actions/checkout 'ref' input as first-class config on GitHubActionsCheckoutStep + a CheckoutRef setter on [GitHubActions]. The ubuntu-latest attribute in Build.CI.GitHubActions.cs now sets CheckoutRef = "${{ github.head_ref }}", so subsequent GenerateTools runs re-emit the patch automatically instead of dropping it. macos-latest and windows-latest are unchanged — they run on push-to-main where HEAD is already attached on the requested commit. Co-Authored-By: Claude Opus 4.7 (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.
Summary
Fixes the annoying GenerateTools whack-a-mole on
ubuntu-latest.yml: the manualref: \${{ github.head_ref }}patch that keeps HEAD attached on PR builds is now first-class config on the[GitHubActions]attribute, so every subsequent regen re-emits it automatically.Background
The
ubuntu-latestPR workflow needsactions/checkoutconfigured withref: \${{ github.head_ref }}because:GitHubTasksTest.GitHubRepositoryFromLocalDirectoryTestreads.git/HEADviaGitRepository.FromLocalDirectory.ref:pin,actions/checkoutlands on a detached merge SHA, so HEAD has no branch →repository.Branchis null → test fails.PR #172's
GenerateToolsrun dropped the manual patch and CI went red. This PR makes the patch survive regenerations.Changes
Fallout.Common/CI/GitHubActions/Configuration/GitHubActionsCheckoutStep.csRefproperty + emitsref: <value>in the YAML when set.Fallout.Common/CI/GitHubActions/GitHubActionsAttribute.csCheckoutRefsetter forwards to the step.build/Build.CI.GitHubActions.cs[GitHubActions(\"ubuntu-latest\", ..., CheckoutRef = \"\${{ github.head_ref }}\")]. macOS and Windows stay unchanged (they run on push-to-main, HEAD already attached)..github/workflows/ubuntu-latest.ymlref:line, no hand-written comment needed.Test plan
dotnet run --project build/_build.csproj -- GenerateBuildServerConfigurationsproduces the expectedref:line.dotnet test fallout.slnx— 425/425 pass.🤖 Generated with Claude Code