Skip to content

[WIP] Fix failing GitHub Actions workflow build#22780

Merged
lpcox merged 2 commits into
copilot/update-safeoutputs-prevent-pushfrom
copilot/fix-github-actions-workflow-build
Mar 24, 2026
Merged

[WIP] Fix failing GitHub Actions workflow build#22780
lpcox merged 2 commits into
copilot/update-safeoutputs-prevent-pushfrom
copilot/fix-github-actions-workflow-build

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 24, 2026

  • Investigate the failing CI job (Job ID: 68446893456)
  • Identify root cause: smoke-gemini.md fails to compile because GH_AW_GEMINI_BASE_CONFIG env var is set to a raw JSON object (starting with {) without YAML quoting, causing GitHub Actions schema validation to fail
  • Fix FormatStepWithCommandAndEnv in engine_helpers.go to properly YAML-quote values that start with { or [
  • Update the test for generateGeminiSettingsStep to verify YAML-safe env var encoding
  • Run make recompile to verify the fix works
  • Run make agent-finish to validate
Original prompt

Fix the failing GitHub Actions workflow build
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 68446893456
Job URL: https://github.com/github/gh-aw/actions/runs/23515517330/job/68446893456


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

@lpcox lpcox marked this pull request as ready for review March 24, 2026 23:01
Copilot AI review requested due to automatic review settings March 24, 2026 23:01
@lpcox lpcox merged commit ee5a0c7 into copilot/update-safeoutputs-prevent-push Mar 24, 2026
49 checks passed
@lpcox lpcox deleted the copilot/fix-github-actions-workflow-build branch March 24, 2026 23:01
Copilot AI requested a review from lpcox March 24, 2026 23:01
Copilot stopped work on behalf of lpcox due to an error March 24, 2026 23:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FormatStepWithCommandAndEnv to YAML-quote env var values that start with { or [ via a new yamlStringValue helper.
  • 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_CONFIG values.

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.

Comment on lines +221 to +223
// 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 ”).
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// 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 '').

Copilot uses AI. Check for mistakes.
Comment on lines +525 to +526
// 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")
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
// 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")

Copilot uses AI. Check for mistakes.
lpcox added a commit that referenced this pull request Mar 24, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants