Uh oh!
There was an error while loading. Please reload this page.
[WIP] Fix failing GitHub Actions workflow test - #13966
Conversation
- In release mode without an agent file, skip automatic checkout since actions are pinned to remote refs and don't require .github/actions - In dev/script mode or with uninitialized mode, add checkout for local .github and .actions access - Preserves existing behavior for agent file imports and custom steps Fixes failing test: TestCheckoutWithAgentFromImports/no_checkout_without_agent_and_permissions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR fixes a failing test by updating the shouldAddCheckoutStep function to properly handle different action modes. Previously, the function always returned true, assuming checkout was always needed for accessing .github and .actions folders. However, in release mode, actions use remote SHA-pinned references instead of local paths, so checking out the repository is unnecessary when no agent file is specified.
Changes:
- Modified
shouldAddCheckoutStepto skip checkout in release mode when no agent file is specified - Added logic to distinguish between dev/script modes (which need checkout for local
.githuband.actionsaccess) and release mode (which uses remote action references) - Aligned behavior with the permissions logic in
compiler_activation_jobs.gowhich only addscontents: readin dev/script mode
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Smoke Test Results (Run 21722230812)PRs Reviewed:
Test Results:
Overall Status: ✅ PASS cc: @pelikhan
|
Fix TestCheckoutWithAgentFromImports test failure
The test
TestCheckoutWithAgentFromImports/no_checkout_without_agent_and_permissionswas failing because theshouldAddCheckoutStepfunction inpkg/workflow/compiler_jobs.gounconditionally returnedtrue, assuming the agent job always needs checkout.Root Cause
The function commented that "Agent job always gets contents: read permission for .github and .actions access" and always returned true. However, in release mode (
ActionModeRelease), actions are pinned to remote references (e.g.,github/gh-aw/.github/actions/setup@sha) rather than local paths, so checking out the.github/actionsfolder is unnecessary.Solution
Updated
shouldAddCheckoutStepto:This change aligns with the logic in
compiler_activation_jobs.golines 37-46, which only addscontents: readpermission when in dev/script mode.Testing
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.