From 8770623519e58ced27d23a7cac18a592024ffe7f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2026 03:15:25 +0000 Subject: [PATCH 1/3] Fix yamllint indentation warnings in workflow_call on: sections injectWorkflowCallOutputs and injectWorkflowCallSecretsSection re-marshal the on: section with plain yaml.Marshal, dropping the IndentSequence(true) option applied earlier in extractTopLevelYAMLSection. This flattened sequence items (e.g. schedule cron lists) back to the same indent as their parent key, triggering yamllint's default indentation rule. Co-Authored-By: Claude Sonnet 5 --- pkg/workflow/compiler_workflow_call.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/workflow/compiler_workflow_call.go b/pkg/workflow/compiler_workflow_call.go index 25bb0ac32ed..98fd3cedfaa 100644 --- a/pkg/workflow/compiler_workflow_call.go +++ b/pkg/workflow/compiler_workflow_call.go @@ -162,9 +162,11 @@ func (c *Compiler) injectWorkflowCallOutputs(onSection string, safeOutputs *Safe workflowCallMap["outputs"] = mergedOutputs onMap["workflow_call"] = workflowCallMap - // Re-marshal to YAML + // Re-marshal to YAML. IndentSequence(true) keeps sequence items (e.g. schedule + // cron lists) indented under their parent key, matching extractTopLevelYAMLSection + // and satisfying yamllint's default indentation rule. newOnData := map[string]any{"on": onMap} - newYAML, err := yaml.Marshal(newOnData) + newYAML, err := yaml.MarshalWithOptions(newOnData, yaml.IndentSequence(true)) if err != nil { workflowCallLog.Printf("Warning: failed to marshal on section with workflow_call outputs: %v", err) return onSection @@ -343,7 +345,7 @@ func injectWorkflowCallSecretsSection(onSection string, secrets []string) string // Re-marshal to YAML. newOnData := map[string]any{"on": onMap} - newYAML, err := yaml.Marshal(newOnData) + newYAML, err := yaml.MarshalWithOptions(newOnData, yaml.IndentSequence(true)) if err != nil { workflowCallLog.Printf("Warning: failed to marshal on section with workflow_call secrets: %v", err) return onSection From b3b05937ca572db874efaf4b59af7a9f8162ae9e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 26 Aug 2026 10:12:45 +0000 Subject: [PATCH 2/3] Regenerate workflow_call lock files and add sequence-indentation regression tests Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com> --- .../smoke-workflow-call-with-inputs.lock.yml | 2 +- .../workflows/smoke-workflow-call.lock.yml | 2 +- pkg/workflow/compiler_workflow_call.go | 5 ++-- pkg/workflow/compiler_workflow_call_test.go | 26 +++++++++++++++++++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/smoke-workflow-call-with-inputs.lock.yml b/.github/workflows/smoke-workflow-call-with-inputs.lock.yml index 13a14895691..a0cd37567c3 100644 --- a/.github/workflows/smoke-workflow-call-with-inputs.lock.yml +++ b/.github/workflows/smoke-workflow-call-with-inputs.lock.yml @@ -60,7 +60,7 @@ name: "Smoke Workflow Call with Inputs" on: schedule: - - cron: 0 0 */2 * * + - cron: 0 0 */2 * * workflow_call: inputs: aw_context: diff --git a/.github/workflows/smoke-workflow-call.lock.yml b/.github/workflows/smoke-workflow-call.lock.yml index 4ccf8c9423c..dcd17a8dbf9 100644 --- a/.github/workflows/smoke-workflow-call.lock.yml +++ b/.github/workflows/smoke-workflow-call.lock.yml @@ -61,7 +61,7 @@ name: "Smoke Workflow Call" on: schedule: - - cron: 0 0 */2 * * + - cron: 0 0 */2 * * workflow_call: inputs: aw_context: diff --git a/pkg/workflow/compiler_workflow_call.go b/pkg/workflow/compiler_workflow_call.go index 98fd3cedfaa..9387a3673ae 100644 --- a/pkg/workflow/compiler_workflow_call.go +++ b/pkg/workflow/compiler_workflow_call.go @@ -162,9 +162,8 @@ func (c *Compiler) injectWorkflowCallOutputs(onSection string, safeOutputs *Safe workflowCallMap["outputs"] = mergedOutputs onMap["workflow_call"] = workflowCallMap - // Re-marshal to YAML. IndentSequence(true) keeps sequence items (e.g. schedule - // cron lists) indented under their parent key, matching extractTopLevelYAMLSection - // and satisfying yamllint's default indentation rule. + // Re-marshal to YAML. IndentSequence(true) matches extractTopLevelYAMLSection so + // sequence items (e.g. schedule cron lists) stay indented under their parent key. newOnData := map[string]any{"on": onMap} newYAML, err := yaml.MarshalWithOptions(newOnData, yaml.IndentSequence(true)) if err != nil { diff --git a/pkg/workflow/compiler_workflow_call_test.go b/pkg/workflow/compiler_workflow_call_test.go index bae42d008f1..814285cbe41 100644 --- a/pkg/workflow/compiler_workflow_call_test.go +++ b/pkg/workflow/compiler_workflow_call_test.go @@ -138,6 +138,22 @@ func TestInjectWorkflowCallOutputs(t *testing.T) { }, expectUnchanged: true, }, + { + name: "schedule sequence stays indented under its key", + onSection: `"on": + schedule: + - cron: 0 0 */2 * * + workflow_call:`, + safeOutputs: &SafeOutputsConfig{ + CreateIssues: &CreateIssuesConfig{}, + }, + expectContains: []string{ + " schedule:\n - cron:", + }, + expectAbsent: []string{ + " schedule:\n - cron:", + }, + }, { name: "user-defined outputs are preserved when merged", onSection: `"on": @@ -421,6 +437,16 @@ func TestInjectWorkflowCallSecretsSection(t *testing.T) { secrets: []string{"AUTO_SECRET"}, wantContain: []string{"USER_SECRET", "AUTO_SECRET"}, }, + { + name: "schedule sequence stays indented under its key", + onSection: `"on": + schedule: + - cron: 0 0 */2 * * + workflow_call: {}`, + secrets: []string{"MY_TOKEN"}, + wantContain: []string{"MY_TOKEN", " schedule:\n - cron:"}, + wantAbsent: []string{" schedule:\n - cron:"}, + }, { name: "handles string shorthand on: workflow_call", onSection: `"on": workflow_call`, From 06b4ed8ee7b7dcb9af2594440154d7051449acc4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 26 Aug 2026 14:26:27 +0000 Subject: [PATCH 3/3] Preserve cron expression quoting when injecting workflow_call outputs/secrets Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../smoke-workflow-call-with-inputs.lock.yml | 2 +- .github/workflows/smoke-workflow-call.lock.yml | 2 +- pkg/workflow/compiler_workflow_call.go | 12 ++++++++++-- pkg/workflow/compiler_workflow_call_test.go | 15 ++++++++------- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/smoke-workflow-call-with-inputs.lock.yml b/.github/workflows/smoke-workflow-call-with-inputs.lock.yml index a0cd37567c3..504ae8ce42c 100644 --- a/.github/workflows/smoke-workflow-call-with-inputs.lock.yml +++ b/.github/workflows/smoke-workflow-call-with-inputs.lock.yml @@ -60,7 +60,7 @@ name: "Smoke Workflow Call with Inputs" on: schedule: - - cron: 0 0 */2 * * + - cron: "0 0 */2 * *" workflow_call: inputs: aw_context: diff --git a/.github/workflows/smoke-workflow-call.lock.yml b/.github/workflows/smoke-workflow-call.lock.yml index dcd17a8dbf9..71c2012f964 100644 --- a/.github/workflows/smoke-workflow-call.lock.yml +++ b/.github/workflows/smoke-workflow-call.lock.yml @@ -61,7 +61,7 @@ name: "Smoke Workflow Call" on: schedule: - - cron: 0 0 */2 * * + - cron: "0 0 */2 * *" workflow_call: inputs: aw_context: diff --git a/pkg/workflow/compiler_workflow_call.go b/pkg/workflow/compiler_workflow_call.go index 9387a3673ae..83911e8d203 100644 --- a/pkg/workflow/compiler_workflow_call.go +++ b/pkg/workflow/compiler_workflow_call.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/github/gh-aw/pkg/logger" + "github.com/github/gh-aw/pkg/parser" "github.com/goccy/go-yaml" ) @@ -171,7 +172,7 @@ func (c *Compiler) injectWorkflowCallOutputs(onSection string, safeOutputs *Safe return onSection } - return strings.TrimSuffix(string(newYAML), "\n") + return finalizeWorkflowCallOnSection(newYAML) } // buildWorkflowCallOutputsMap constructs the outputs map for on.workflow_call.outputs @@ -350,5 +351,12 @@ func injectWorkflowCallSecretsSection(onSection string, secrets []string) string return onSection } - return strings.TrimSuffix(string(newYAML), "\n") + return finalizeWorkflowCallOnSection(newYAML) +} + +// finalizeWorkflowCallOnSection post-processes a re-marshaled on: section so it matches +// the formatting produced by extractTopLevelYAMLSection. The YAML library drops quotes +// from cron expressions such as "0 0 */2 * *", so they are re-quoted here. +func finalizeWorkflowCallOnSection(marshaled []byte) string { + return strings.TrimSuffix(parser.QuoteCronExpressions(string(marshaled)), "\n") } diff --git a/pkg/workflow/compiler_workflow_call_test.go b/pkg/workflow/compiler_workflow_call_test.go index 814285cbe41..cd0ba870e63 100644 --- a/pkg/workflow/compiler_workflow_call_test.go +++ b/pkg/workflow/compiler_workflow_call_test.go @@ -139,19 +139,20 @@ func TestInjectWorkflowCallOutputs(t *testing.T) { expectUnchanged: true, }, { - name: "schedule sequence stays indented under its key", + name: "schedule sequence stays indented and cron stays quoted", onSection: `"on": schedule: - - cron: 0 0 */2 * * + - cron: "0 0 */2 * *" workflow_call:`, safeOutputs: &SafeOutputsConfig{ CreateIssues: &CreateIssuesConfig{}, }, expectContains: []string{ - " schedule:\n - cron:", + " schedule:\n - cron: \"0 0 */2 * *\"", }, expectAbsent: []string{ " schedule:\n - cron:", + "- cron: 0 0", }, }, { @@ -438,14 +439,14 @@ func TestInjectWorkflowCallSecretsSection(t *testing.T) { wantContain: []string{"USER_SECRET", "AUTO_SECRET"}, }, { - name: "schedule sequence stays indented under its key", + name: "schedule sequence stays indented and cron stays quoted", onSection: `"on": schedule: - - cron: 0 0 */2 * * + - cron: "0 0 */2 * *" workflow_call: {}`, secrets: []string{"MY_TOKEN"}, - wantContain: []string{"MY_TOKEN", " schedule:\n - cron:"}, - wantAbsent: []string{" schedule:\n - cron:"}, + wantContain: []string{"MY_TOKEN", " schedule:\n - cron: \"0 0 */2 * *\""}, + wantAbsent: []string{" schedule:\n - cron:", "- cron: 0 0"}, }, { name: "handles string shorthand on: workflow_call",