Skip to content

Emit unquoted top-level on: in compiled .lock.yml workflows#32357

Merged
pelikhan merged 3 commits into
mainfrom
copilot/fix-quoted-on-key-in-lock-yml
May 15, 2026
Merged

Emit unquoted top-level on: in compiled .lock.yml workflows#32357
pelikhan merged 3 commits into
mainfrom
copilot/fix-quoted-on-key-in-lock-yml

Conversation

Copilot AI commented May 15, 2026

Copy link
Copy Markdown
Contributor

Bug Fix

gh aw compile currently emits top-level workflow triggers as "on":, which is valid YAML but inconsistent with GitHub Actions conventions and tooling expectations. This change normalizes compiled lock files to use unquoted top-level on: while leaving nested quoted keys untouched.

  • What was the bug?

    Generated *.lock.yml used "on": at the root, creating avoidable inconsistency with hand-authored workflows and editor/linter heuristics keyed on on:.

  • How was it fixed?

    • Added a targeted post-processing helper to unquote only the top-level key when it is exactly "on":.
    • Applied that normalization in workflow body generation after existing on-section transformations.
    • Preserved nested behavior intentionally (no broad unquoting pass).
  • Scope of updates

    • Updated affected assertions in event/centralized command compile tests that previously expected "on":.
    • Added focused unit coverage for top-level-only unquoting semantics.
    • Updated wasm golden fixtures to reflect the normalized on: output.
# before
name: "PR Documentation Check"
"on":
  pull_request:
    branches:
    - main

# after
name: "PR Documentation Check"
on:
  pull_request:
    branches:
    - main

Copilot AI and others added 2 commits May 15, 2026 12:41
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix quoted top-level on key in generated lock.yml Emit unquoted top-level on: in compiled .lock.yml workflows May 15, 2026
Copilot AI requested a review from pelikhan May 15, 2026 13:03
@pelikhan pelikhan marked this pull request as ready for review May 15, 2026 13:03
Copilot AI review requested due to automatic review settings May 15, 2026 13:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Normalizes the compiled *.lock.yml workflow output to emit an unquoted top-level on: key (instead of "on":) for consistency with hand-authored GitHub Actions workflows, while intentionally leaving nested quoted keys unchanged.

Changes:

  • Adds UnquoteYAMLTopLevelKey helper in pkg/workflow/yaml.go and invokes it in generateWorkflowBody after existing on-section transformations.
  • Adds focused unit tests for the helper and a regex-based assertion in compiler_validation_test.go to guard the top-level on: form.
  • Updates affected event/centralized command compile test expectations and wasm golden fixtures to the new unquoted output.
Show a summary per file
File Description
pkg/workflow/yaml.go New top-level-only unquoting helper with doc comment.
pkg/workflow/yaml_test.go Unit tests for UnquoteYAMLTopLevelKey covering top-level, nested, and already-unquoted cases.
pkg/workflow/compiler_yaml.go Applies the new helper to the on section in workflow body generation.
pkg/workflow/compiler_validation_test.go Regex assertion ensuring generated YAML has unquoted top-level on:.
pkg/workflow/compiler_events_test.go Updates expected on strings to the unquoted form.
pkg/workflow/slash_command_centralized_compile_test.go Updates expected substring to the unquoted form.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/*.golden Golden updates to reflect unquoted on:.
pkg/workflow/testdata/wasm_golden/WasmBinary/*.golden Wasm golden updates to reflect unquoted on:.
.github/workflows/ci-coach.lock.yml Large lock file regeneration; still contains "on": and includes unrelated version/structure drift.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 15/15 changed files
  • Comments generated: 1

Comment on lines 1 to 66
@@ -14,7 +14,7 @@
# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
#
# This file was automatically generated by gh-aw (v0.72.1). DO NOT EDIT.
# This file was automatically generated by gh-aw. DO NOT EDIT.
#
# To update this file, edit the corresponding .md file and run:
# gh aw compile
@@ -47,26 +47,25 @@
# - actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
# - actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9)
# - actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
# - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
# - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
# - github/gh-aw-actions/setup@v0.72.1
#
# Container images used:
# - ghcr.io/github/gh-aw-firewall/agent:0.25.41@sha256:cb2b565d070116d4b67e355775340528b5a2c3cb18b2c9049638bcc2df681770
# - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.41@sha256:fadd0de387209f69a9a7a1b8722bb5e7fdfb80ba9749a5c60f0e4cd7582a74d0
# - ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.41@sha256:62171f2fa508667b8b0a9e096f826983f312e3da0ce894f80c0f83a875af60fe
# - ghcr.io/github/gh-aw-firewall/squid:0.25.41@sha256:1260445d25968dbf3ae70143964177a0e5914cf2ce07a6117f7d3caec6c3e3c4
# - ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c
# - ghcr.io/github/gh-aw-firewall/agent:0.25.46
# - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.46
# - ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.46
# - ghcr.io/github/gh-aw-firewall/squid:0.25.46
# - ghcr.io/github/gh-aw-mcpg:v0.3.9@sha256:64828b42a4482f58fab16509d7f8f495a6d97c972a98a68aff20543531ac0388
# - ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959
# - node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f

name: "CI Optimization Coach"
"on":
@pelikhan pelikhan merged commit d21a90a into main May 15, 2026
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-quoted-on-key-in-lock-yml branch May 15, 2026 13:08
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.

Generated *.lock.yml files quote the top-level on: key

3 participants