Repository navigation
workflowfile: honour GH_ACTIONS_LOCK_REPO_ROOT for repo root discovery - #160
Merged
Merged
Conversation
Callers relocking a partial checkout without .git could not resolve $/ actions. The override must exist and contain the workflow path; $/ paths stay bounded by it like the git root.
There was a problem hiding this comment.
🟡 Changes recommended
Workflow symlinks can bypass the promised override containment check, and the unset-environment test is process-dependent.
2 open findings
What changed in this PR
Adds explicit repository-root discovery for partial checkouts through GH_ACTIONS_LOCK_REPO_ROOT.
Changes:
- Applies the override to action resolution, migration, and composite discovery.
- Validates override paths and documents the environment variable.
- Adds unit and command-level coverage.
| File | Description |
|---|---|
internal/workflowfile/workflowfile.go |
Implements override discovery and validation. |
internal/workflowfile/workflowfile_test.go |
Tests override behavior and boundaries. |
internal/workflowfile/rewrite.go |
Propagates discovery errors during migration. |
cmd/gh-actions-lock/run.go |
Uses the override during migration sweeps. |
cmd/gh-actions-lock/root.go |
Documents the environment variable. |
cmd/gh-actions-lock/reporoot_test.go |
Adds command-level partial-checkout coverage. |
cmd/gh-actions-lock/atomic_test.go |
Extracts shared HTTP test setup. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Git-mode root discovery never resolved the workflow file itself, and $/ containment is enforced on the action paths it reaches.
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
Repo root discovery only walks up looking for
.git. Callers relocking a partial checkout without.gitfail on any$/action with "not in a git repository" (exit 2), so workflows that use$/can't be relocked there.Fix
GH_ACTIONS_LOCK_REPO_ROOTnames the root explicitly. An env var rather than a flag, so callers can set it unconditionally and older versions ignore it.$/resolution,./composite discovery, migration, and the composite-file sweep.$/against the wrong tree.$/paths stay bounded by it, same as the git root.--help.