Summary
Multiline engine.env.COPILOT_GITHUB_TOKEN expressions again compile to invalid workflow YAML.
Version testing:
| Version |
Result |
| v0.82.4 |
Compiles |
| v0.82.5 |
Fails |
| v0.82.14 |
Fails |
| v0.82.15 prerelease |
Fails |
| Current public main |
Fails |
This is a regression of #30204 / #30240, introduced through the OAuth-token validation path added by #44204.
Minimal reproduction
---
on:
workflow_dispatch:
engine:
id: copilot
env:
COPILOT_GITHUB_TOKEN: >-
${{ secrets.EXAMPLE_TOKEN_A != '' && secrets.EXAMPLE_TOKEN_A ||
secrets.EXAMPLE_TOKEN_B != '' && secrets.EXAMPLE_TOKEN_B ||
secrets.EXAMPLE_TOKEN_C }}
---
Reproduce.
Compile it:
gh aw compile reproduce --approve
Actual result
Compilation fails while validating the generated lock file:
generated lock file is not valid YAML: non-map value is specified
...
env:
COPILOT_GITHUB_TOKEN: ${{ secrets.EXAMPLE_TOKEN_A != '' && secrets.EXAMPLE_TOKEN_A ||
secrets.EXAMPLE_TOKEN_B != '' && secrets.EXAMPLE_TOKEN_B ||
The continuation lines are emitted without YAML block-scalar indentation in the generated Check for OAuth tokens activation step.
Expected result
Compilation succeeds, and every generated use of the multiline environment value is emitted as a properly indented YAML block scalar.
Root cause
#30240 introduced appendEnvVarLine in pkg/workflow/engine_helpers.go to correctly emit multiline engine.env values.
The OAuth check added by #44204 uses a separate emission path in pkg/workflow/compiler_activation_steps.go:
ctx.steps = append(ctx.steps, fmt.Sprintf(" %s: %s\n", constants.CopilotGitHubToken, copilotTokenExpr))
That bypasses appendEnvVarLine, while existing secret-validation and engine-execution paths continue to emit the value correctly.
Workaround
Place the entire COPILOT_GITHUB_TOKEN expression on one line.
Agentic implementation plan
- Update the OAuth validation step in
pkg/workflow/compiler_activation_steps.go to emit COPILOT_GITHUB_TOKEN through appendEnvVarLine rather than inline fmt.Sprintf.
- Preserve the activation step's current indentation and newline conventions.
- Add a multiline override test to
pkg/workflow/compiler_activation_jobs_test.go that verifies a valid literal block scalar in the OAuth step.
- Add end-to-end compile coverage for multiline values written with both
| and >-.
- Confirm existing single-line expressions remain emitted inline without behavior changes.
References: #30204, #30240, #44204.
Summary
Multiline
engine.env.COPILOT_GITHUB_TOKENexpressions again compile to invalid workflow YAML.Version testing:
This is a regression of #30204 / #30240, introduced through the OAuth-token validation path added by #44204.
Minimal reproduction
Compile it:
Actual result
Compilation fails while validating the generated lock file:
The continuation lines are emitted without YAML block-scalar indentation in the generated
Check for OAuth tokensactivation step.Expected result
Compilation succeeds, and every generated use of the multiline environment value is emitted as a properly indented YAML block scalar.
Root cause
#30240 introduced
appendEnvVarLineinpkg/workflow/engine_helpers.goto correctly emit multilineengine.envvalues.The OAuth check added by #44204 uses a separate emission path in
pkg/workflow/compiler_activation_steps.go:That bypasses
appendEnvVarLine, while existing secret-validation and engine-execution paths continue to emit the value correctly.Workaround
Place the entire
COPILOT_GITHUB_TOKENexpression on one line.Agentic implementation plan
pkg/workflow/compiler_activation_steps.goto emitCOPILOT_GITHUB_TOKENthroughappendEnvVarLinerather than inlinefmt.Sprintf.pkg/workflow/compiler_activation_jobs_test.gothat verifies a valid literal block scalar in the OAuth step.|and>-.References: #30204, #30240, #44204.