Skip to content

feat(ci): teach [GitHubActions] about CheckoutRef so regen preserves the ref pin#175

Merged
ChrisonSimtian merged 1 commit into
mainfrom
feature/110-checkout-ref-attribute
May 25, 2026
Merged

feat(ci): teach [GitHubActions] about CheckoutRef so regen preserves the ref pin#175
ChrisonSimtian merged 1 commit into
mainfrom
feature/110-checkout-ref-attribute

Conversation

@ChrisonSimtian
Copy link
Copy Markdown
Owner

Summary

Fixes the annoying GenerateTools whack-a-mole on ubuntu-latest.yml: the manual ref: \${{ 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-latest PR workflow needs actions/checkout configured with ref: \${{ github.head_ref }} because:

  • GitHubTasksTest.GitHubRepositoryFromLocalDirectoryTest reads .git/HEAD via GitRepository.FromLocalDirectory.
  • On PR builds without the ref: pin, actions/checkout lands on a detached merge SHA, so HEAD has no branch → repository.Branch is null → test fails.

PR #172's GenerateTools run dropped the manual patch and CI went red. This PR makes the patch survive regenerations.

Changes

File Change
Fallout.Common/CI/GitHubActions/Configuration/GitHubActionsCheckoutStep.cs New Ref property + emits ref: <value> in the YAML when set.
Fallout.Common/CI/GitHubActions/GitHubActionsAttribute.cs New CheckoutRef setter 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.yml Regenerated from the new attribute — same ref: line, no hand-written comment needed.

Test plan

  • Regen via dotnet run --project build/_build.csproj -- GenerateBuildServerConfigurations produces the expected ref: line.
  • dotnet test fallout.slnx — 425/425 pass.
  • CI ubuntu-latest green (validates the patch still works through the regen path).

🤖 Generated with Claude Code

…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>
@ChrisonSimtian ChrisonSimtian merged commit 03d69b8 into main May 25, 2026
1 check passed
@ChrisonSimtian ChrisonSimtian deleted the feature/110-checkout-ref-attribute branch May 25, 2026 08:08
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.

1 participant