Define GH_AW_HOME at job level to eliminate fallback macro repetition#19823
Define GH_AW_HOME at job level to eliminate fallback macro repetition#19823pelikhan merged 2 commits intoportable-gh-aw-homefrom
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR centralizes the GH_AW_HOME default (/opt/gh-aw) by defining it once at the job level, removing repeated fallback expressions in generated shell run: steps and JS require() statements across compiled workflows and golden fixtures.
Changes:
- Updated
GhAwHome/GhAwHomeJSconstants to use${GH_AW_HOME}/process.env.GH_AW_HOME(no inline fallbacks). - Ensured consuming jobs initialize job-level
envwithGH_AW_HOME: /opt/gh-aw(including main/activation/conclusion/safe outputs/cache/repo memory/custom safe jobs/maintenance workflows). - Recompiled and updated workflow lock files and golden test fixtures; updated tests asserting the old fallback strings.
Reviewed changes
Copilot reviewed 48 out of 207 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/with-imports.golden | Golden YAML updated to include job-level GH_AW_HOME and remove fallback usage in shell/JS. |
| pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/smoke-copilot.golden | Golden YAML updated to include job-level GH_AW_HOME and remove fallback usage in shell/JS. |
| pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/basic-copilot.golden | Golden YAML updated to include job-level GH_AW_HOME and remove fallback usage in shell/JS. |
| pkg/workflow/template_rendering_test.go | Test expectations updated to match new require(process.env.GH_AW_HOME + ...) strings. |
| pkg/workflow/template_injection_validation_test.go | Test strings updated to reference ${GH_AW_HOME} without fallback. |
| pkg/workflow/temp_folder_test.go | Test expectation updated to ${GH_AW_HOME}/prompts/... path. |
| pkg/workflow/step_summary_test.go | Test expectations updated to match new JS require path concatenation. |
| pkg/workflow/step_order_validation_test.go | Updated test path to ${GH_AW_HOME}/... (no fallback). |
| pkg/workflow/step_order_validation_integration_test.go | Updated integration test path to ${GH_AW_HOME}/... (no fallback). |
| pkg/workflow/setup_action_paths.go | Updated path constants to rely on GH_AW_HOME being set at job level (no fallback). |
| pkg/workflow/secret_validation_test.go | Updated test expectations for secret validation script paths without fallback. |
| pkg/workflow/safe_jobs.go | Custom safe jobs now set GH_AW_HOME at the job level by default. |
| pkg/workflow/repo_memory_test.go | Updated expected script invocation path to ${GH_AW_HOME}/.... |
| pkg/workflow/repo_memory_integration_test.go | Updated expected JS require + bash paths to use GH_AW_HOME without fallback. |
| pkg/workflow/repo_memory.go | Push repo memory job now sets GH_AW_HOME in job env. |
| pkg/workflow/prompts_test.go | Updated expected prompt file references to ${GH_AW_HOME}/prompts/.... |
| pkg/workflow/pr_checkout_test.go | Updated expected PR prompt references to ${GH_AW_HOME}/prompts/.... |
| pkg/workflow/notify_comment.go | Conclusion job now sets GH_AW_HOME in job env. |
| pkg/workflow/mcp_config_refactor_test.go | Updated expected MCP config entrypoint/args paths to ${GH_AW_HOME}/... (mount fallback intentionally unchanged). |
| pkg/workflow/maintenance_workflow.go | Maintenance workflow templates updated to include job-level GH_AW_HOME. |
| pkg/workflow/main_job_env_test.go | Updated tests to expect GH_AW_HOME always present in main job env. |
| pkg/workflow/inference_access_error_test.go | Updated expected script path to ${GH_AW_HOME}/.... |
| pkg/workflow/git_config_test.go | Updated expected clean-credentials script path to ${GH_AW_HOME}/.... |
| pkg/workflow/firewall_version_pinning_test.go | Updated expected install script path to ${GH_AW_HOME}/.... |
| pkg/workflow/engine_includes_test.go | Updated expected Copilot installer script path to ${GH_AW_HOME}/.... |
| pkg/workflow/engine_helpers_shared_test.go | Updated expected MCP start script path to ${GH_AW_HOME}/.... |
| pkg/workflow/docker_predownload_test.go | Updated expected docker predownload script path to ${GH_AW_HOME}/.... |
| pkg/workflow/detection_success_test.go | Updated expected JS require path to process.env.GH_AW_HOME + .... |
| pkg/workflow/copilot_installer_test.go | Updated expected Copilot install script path to ${GH_AW_HOME}/.... |
| pkg/workflow/compiler_yaml_main_job_test.go | Updated expected temp dir creation script path to ${GH_AW_HOME}/.... |
| pkg/workflow/compiler_safe_outputs_steps_test.go | Updated expected handler require paths to process.env.GH_AW_HOME + .... |
| pkg/workflow/compiler_safe_outputs_job.go | Safe outputs job-level env now explicitly includes GH_AW_HOME. |
| pkg/workflow/compiler_main_job.go | Main agent job now always initializes job env (including GH_AW_HOME). |
| pkg/workflow/compiler_activation_job.go | Activation job now sets GH_AW_HOME in job env. |
| pkg/workflow/codex_engine_test.go | Updated expected MCP start script path to ${GH_AW_HOME}/.... |
| pkg/workflow/cache_memory_integration_test.go | Updated expected prompt reference to ${GH_AW_HOME}/.... |
| pkg/workflow/cache.go | Cache update job now always includes GH_AW_HOME and conditionally adds sanitized workflow ID. |
| pkg/workflow/aw_info_tmp_test.go | Updated expected JS require path to process.env.GH_AW_HOME + .... |
| pkg/workflow/agentic_output_test.go | Updated expected safe-outputs env exports to ${GH_AW_HOME}/... paths. |
| .github/workflows/test-workflow.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/metrics-collector.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/issue-triage-agent.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/issue-arborist.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/firewall.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/example-permissions-warning.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/daily-syntax-error-quality.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/daily-malicious-code-scan.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/daily-fact.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/codex-github-remote-mcp-test.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/chroma-issue-indexer.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/bot-detection.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
| .github/workflows/agentics-maintenance.yml | Maintenance workflow updated to define GH_AW_HOME at job level and simplify require() paths. |
| .github/workflows/ace-editor.lock.yml | Recompiled lockfile: added job-level GH_AW_HOME and removed fallback usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Every shell
run:step and JSrequire()call repeated the fallback macro${GH_AW_HOME:-/opt/gh-aw}/(process.env.GH_AW_HOME || '/opt/gh-aw'). Defining the variable once at the job level removes that noise from every step.Constants
GhAwHome:${GH_AW_HOME:-/opt/gh-aw}→${GH_AW_HOME}GhAwHomeJS:(process.env.GH_AW_HOME || '/opt/gh-aw')→process.env.GH_AW_HOMEJob-level
env: GH_AW_HOME: /opt/gh-awadded to all consuming jobsactivation—compiler_activation_job.goagent—compiler_main_job.go(env map now always initialized)conclusion—notify_comment.gosafe_outputs—compiler_safe_outputs_job.goupdate_cache_memory—cache.gopush_repo_memory—repo_memory.gosafe_jobs—safe_jobs.goclose-expired-entities,run_operation,compile-workflows,secret-validation) —maintenance_workflow.goAll 167 workflow lock files recompiled; zero occurrences of the old
:-/opt/gh-awfallback remain in generated YAML.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.