Skip to content

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

Description

@IEvangelist

Description

The gh aw compile command emits the top-level on: key as a quoted string ("on":) in generated *.lock.yml files, instead of the conventional unquoted on: used throughout GitHub Actions workflows.

Example

See microsoft/aspire/.github/workflows/pr-docs-check.lock.yml#L64:

name: "PR Documentation Check"
"on":
  pull_request:
    branches:
    - main
    - release/*
    types:
    - closed

Generated by gh-aw v0.72.0.

Expected

name: "PR Documentation Check"
on:
  pull_request:
    ...

Why this happens

In YAML 1.1, the bare word on is interpreted as a boolean (true). Many YAML emitters defensively quote it to avoid ambiguity. However, GitHub Actions uses YAML 1.2 (where on is just a string), and every hand-written workflow file in the wild uses the unquoted form. The quoted form, while functionally equivalent and parsed correctly by GitHub Actions, looks inconsistent next to the rest of the ecosystem and trips up syntax highlighters / linters that special-case on: as a workflow trigger.

Severity

Cosmetic / minor — workflows still execute correctly. Filing for awareness; would be a nice polish for generated lock files to match GitHub Actions conventions.

Suggested fix

Either:

  1. Configure the YAML emitter to treat on as a non-reserved key (most Go YAML libraries have an option for this), or
  2. Post-process the emitted YAML to unquote the top-level on: key.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions