Summary
The GH_AW_WORKFLOWS_DIR env-var override that constants.GetWorkflowDir() honors (pkg/constants/constants.go:338-343) is silently bypassed at 5 production call sites that assemble the workflows path with filepath.Join(*, ".github", "workflows") instead of using the helper. Setting the env var to e.g. custom/dir produces inconsistent runtime behavior: most code paths look at the override, but these 5 paths keep looking at .github/workflows.
Cross-reference: continuation of #aw_sg9a1 (Run 9) which fixed the helper itself.
Locations
Real bugs (env override does not take effect):
pkg/workflow/dispatch_workflow_file_resolver.go:70 — searchDir := filepath.Join(repoRoot, ".github", "workflows") — the actual search directory for dispatch workflow resolution.
pkg/cli/copilot_setup.go:186 — workflowsDir := filepath.Join(".github", "workflows") — passed to os.MkdirAll, so the directory created on disk doesn't honor the override.
pkg/cli/init.go:214 — workflowsDir := filepath.Join(gitRoot, ".github", "workflows") — used in os.Stat early-exit check for maintenance-workflow generation.
Lower severity (error-message construction only):
pkg/workflow/dispatch_workflow_validation.go:61
pkg/workflow/call_workflow_validation.go:75
Impact
- Severity: High — the env-override is a documented public contract (
pkg/constants/README.md:349) that takes effect only partially.
- User-visible failure mode: a user setting
GH_AW_WORKFLOWS_DIR=custom/dir sees workflows correctly resolved by the compiler, but dispatch_workflow_file_resolver searches the wrong directory, copilot_setup creates .github/workflows instead of custom/dir, and init skips maintenance-workflow generation because it stats the wrong path.
- Affected files: 5 prod files (3 real bugs, 2 cosmetic).
Recommendation
Replace filepath.Join(*, ".github", "workflows") with filepath.Join(*, constants.GetWorkflowDir()) at every site. Example:
Before:
searchDir := filepath.Join(repoRoot, ".github", "workflows")
After:
searchDir := filepath.Join(repoRoot, constants.GetWorkflowDir())
Note: GetWorkflowDir() already returns a forward-slash path, so filepath.Join normalizes correctly per-OS.
Validation
References:
- §25953081117
- Prior issue #aw_sg9a1 (env-var support landed in
constants.GetWorkflowDir)
Generated by Sergo — Run 11
Generated by 🤖 Sergo - Serena Go Expert · ● 15.6M · ◷
Summary
The
GH_AW_WORKFLOWS_DIRenv-var override thatconstants.GetWorkflowDir()honors (pkg/constants/constants.go:338-343) is silently bypassed at 5 production call sites that assemble the workflows path withfilepath.Join(*, ".github", "workflows")instead of using the helper. Setting the env var to e.g.custom/dirproduces inconsistent runtime behavior: most code paths look at the override, but these 5 paths keep looking at.github/workflows.Cross-reference: continuation of #aw_sg9a1 (Run 9) which fixed the helper itself.
Locations
Real bugs (env override does not take effect):
pkg/workflow/dispatch_workflow_file_resolver.go:70—searchDir := filepath.Join(repoRoot, ".github", "workflows")— the actual search directory for dispatch workflow resolution.pkg/cli/copilot_setup.go:186—workflowsDir := filepath.Join(".github", "workflows")— passed toos.MkdirAll, so the directory created on disk doesn't honor the override.pkg/cli/init.go:214—workflowsDir := filepath.Join(gitRoot, ".github", "workflows")— used inos.Statearly-exit check for maintenance-workflow generation.Lower severity (error-message construction only):
pkg/workflow/dispatch_workflow_validation.go:61pkg/workflow/call_workflow_validation.go:75Impact
pkg/constants/README.md:349) that takes effect only partially.GH_AW_WORKFLOWS_DIR=custom/dirsees workflows correctly resolved by the compiler, butdispatch_workflow_file_resolversearches the wrong directory,copilot_setupcreates.github/workflowsinstead ofcustom/dir, andinitskips maintenance-workflow generation because it stats the wrong path.Recommendation
Replace
filepath.Join(*, ".github", "workflows")withfilepath.Join(*, constants.GetWorkflowDir())at every site. Example:Before:
After:
Note:
GetWorkflowDir()already returns a forward-slash path, sofilepath.Joinnormalizes correctly per-OS.Validation
GH_AW_WORKFLOWS_DIR=custom/dir, rungh aw copilot-setup— verifycustom/dir/copilot-setup-steps.ymlis created (not.github/workflows/...).filepath.Join(*, ".github", "workflows")left inpkg/non-test.References:
constants.GetWorkflowDir)Generated by Sergo — Run 11