[WIP] Fix failing GitHub Actions workflow build#22780
Conversation
…AndEnv Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3385ade1-575c-470d-af03-d2f886c1e301
ee5a0c7
into
copilot/update-safeoutputs-prevent-push
There was a problem hiding this comment.
Pull request overview
Fixes a GitHub Actions workflow YAML schema validation failure caused by emitting a raw JSON object into an env: value without YAML-safe quoting.
Changes:
- Update
FormatStepWithCommandAndEnvto YAML-quote env var values that start with{or[via a newyamlStringValuehelper. - Add unit tests covering YAML-safe quoting behavior and ensuring GitHub Actions expressions remain unquoted.
- Regenerate/update the locked Gemini smoke workflow to single-quote
GH_AW_GEMINI_BASE_CONFIGvalues.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pkg/workflow/engine_helpers.go |
Ensures env values beginning with JSON flow indicators are emitted as YAML-safe strings. |
pkg/workflow/engine_helpers_test.go |
Adds coverage for yamlStringValue and YAML-safe env formatting behavior. |
pkg/workflow/gemini_engine_test.go |
Adds a regression test to assert Gemini settings step emits YAML-safe quoting for the JSON env var. |
.github/workflows/smoke-gemini.lock.yml |
Updates generated workflow output to single-quote the JSON config env var. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // If the value starts with a YAML flow indicator ('{' or '[') or other characters | ||
| // that would cause it to be misinterpreted by YAML parsers, it wraps the value | ||
| // in single quotes. Any embedded single quotes are escaped by doubling them (' becomes ”). |
There was a problem hiding this comment.
The docstring is inaccurate/confusing: it says values may be misinterpreted due to “other characters”, but the implementation only quotes when the first byte is '{' or '['. It also describes escaping single quotes as "(' becomes ”)", which is incorrect (YAML single-quote escaping is done by doubling the single quote: ''), and the current text uses a curly quote character.
| // If the value starts with a YAML flow indicator ('{' or '[') or other characters | |
| // that would cause it to be misinterpreted by YAML parsers, it wraps the value | |
| // in single quotes. Any embedded single quotes are escaped by doubling them (' becomes ”). | |
| // If the value starts with a YAML flow indicator ('{' or '['), it wraps the value | |
| // in single quotes. Any embedded single quotes are escaped by doubling them (' | |
| // becomes ''). |
| // The JSON value must be single-quoted so YAML doesn't treat it as an object | ||
| assert.Contains(t, content, "GH_AW_GEMINI_BASE_CONFIG: '", "JSON env var value must be single-quoted for valid YAML") |
There was a problem hiding this comment.
This assertion only checks for the presence of "GH_AW_GEMINI_BASE_CONFIG: '" and would still pass if the value is missing a closing quote (or otherwise malformed). Consider strengthening the test to verify that the env var value is properly single-quoted as a whole (e.g., the line starts with the key and contains a closing single quote at the end, or by parsing the generated YAML).
| // The JSON value must be single-quoted so YAML doesn't treat it as an object | |
| assert.Contains(t, content, "GH_AW_GEMINI_BASE_CONFIG: '", "JSON env var value must be single-quoted for valid YAML") | |
| // The JSON value must be single-quoted so YAML doesn't treat it as an object. | |
| // Find the specific line and verify the entire value is enclosed in single quotes. | |
| var envLine string | |
| for _, line := range strings.Split(content, "\n") { | |
| if strings.Contains(line, "GH_AW_GEMINI_BASE_CONFIG:") { | |
| envLine = line | |
| break | |
| } | |
| } | |
| require.NotEmpty(t, envLine, "GH_AW_GEMINI_BASE_CONFIG line should be present in step") | |
| trimmed := strings.TrimSpace(envLine) | |
| assert.True(t, strings.HasPrefix(trimmed, "GH_AW_GEMINI_BASE_CONFIG: '"), | |
| "JSON env var value must start with a single quote for valid YAML") | |
| assert.True(t, strings.HasSuffix(trimmed, "'"), | |
| "JSON env var value must end with a single quote for valid YAML") |
…safeoutputs (#22776) * chore: start branch protection check implementation Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3eafba71-8866-4a6f-aeae-4e8436199b9a * security: block agents from pushing to default/protected branches in safeoutputs Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3eafba71-8866-4a6f-aeae-4e8436199b9a * [WIP] Fix failing GitHub Actions workflow build (#22777) * Initial plan * Initial plan Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/339fab7a-9e6e-4ab8-bc11-159fb851e2e4 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * [WIP] Fix failing GitHub Actions workflow js (#22779) * Initial plan * fix: add type narrowing for protectionError.status in push_to_pull_request_branch.cjs Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cec972d3-973f-430c-a2a6-4e28c234890b --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * [WIP] Fix failing GitHub Actions workflow build (#22780) * Initial plan * fix: properly YAML-quote JSON env var values in FormatStepWithCommandAndEnv Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3385ade1-575c-470d-af03-d2f886c1e301 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
smoke-gemini.mdfails to compile becauseGH_AW_GEMINI_BASE_CONFIGenv var is set to a raw JSON object (starting with{) without YAML quoting, causing GitHub Actions schema validation to failFormatStepWithCommandAndEnvinengine_helpers.goto properly YAML-quote values that start with{or[generateGeminiSettingsStepto verify YAML-safe env var encodingmake recompileto verify the fix worksmake agent-finishto validateOriginal prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.