Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The guard misses alternate-repository checkouts and checkout context inherited by migrated composite actions.
1 open finding
What changed in this PR
Adds safeguards to prevent unsafe ./… to $/… migrations after custom-ref checkouts.
Changes:
- Detects preceding custom-ref checkout steps.
- Preserves all-or-nothing migration behavior.
- Adds unit, command, alias, and documentation coverage.
| File | Description |
|---|---|
README.md |
Documents migration restrictions. |
internal/workflowfile/workflowfile_test.go |
Tests ref classification. |
internal/workflowfile/rewrite.go |
Implements checkout validation. |
internal/workflowfile/rewrite_test.go |
Tests ordering, scope, and aliases. |
cmd/gh-actions-lock/migrate_test.go |
Verifies atomic CLI failure. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if err := f.validateCheckoutRefsForMigration(replacements); err != nil { | ||
| return append([]byte(nil), f.Content...), 0, err |
There was a problem hiding this comment.
This would also require checking if any workflow hits that composite action with a custom checkout step, not just the one being migrated.
There was a problem hiding this comment.
Thanks, this is covered in 70c32f8. All workflows are checked before shared composite actions are rewritten, with a regression test confirming that a custom-ref checkout in an unselected workflow blocks migration without changing any files.
|
For |
|
@jessehouwing |
| workflowPaths, err := workflowfile.DiscoverWorkflowsIn(filepath.Join(repoRoot, ".github", "workflows")) | ||
| if err != nil { | ||
| return 0, undo, err | ||
| } |


Problem
Migrating
./local-actionto$/local-actionchanges which code runs when a precedingactions/checkoutstep selects a different ref. The local path reads the checked-out workspace, while$/resolves at the running commit.This also affects nested references: a workflow can check out a custom ref and call an existing
$/outerwhose definition still uses./inner. A file-local check misses that migration.Fix
Reject the migration before writing any files when a preceding checkout has a non-empty
refother than${{ github.sha }}. The error identifies the action being migrated and the checkout's ref, file, and line, and points to--no-migrate-local-actionsto preserve local references../…and$/…composite calls and back to subsequent caller steps. Keep jobs independent.The guard covers explicit checkout steps in workflows and in-repo composite actions; it does not analyze workspace changes through scripts or remote actions. Workflows retaining
./…references still cannot be onboarded to the lockfile.Fixes #112.
Tests
make test(including the race-enabled Go suite),make build fmt-check vet, and all 34make test-stubscenarios passed.custom-ref checkout → $/outer → ./innerexited 2, reported the checkout source, and left every file unchanged in both full and scoped runs.