Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid YAML generated when formatting a file with comments #75

Open
wojciechka opened this issue Oct 9, 2024 · 0 comments
Open

Invalid YAML generated when formatting a file with comments #75

wojciechka opened this issue Oct 9, 2024 · 0 comments

Comments

@wojciechka
Copy link
Member

Ran into an error with yam when working on a YAML manifest for a package that had multiple comments.

Minimal YAML file to reproduce the issue:

package:
  name: example
  version: 0.0.1
  epoch: 0
  description: Example app
pipeline:
  - uses: git-checkout
    with:
      repository: https://github.com/example/example
      tag: v${{package.version}}
      expected-commit: testabc
  # NOTE: commented out command
  # - runs: |
  #     make target

  - uses: go/build
    with:
      tags: "test"

This has an entire element in the pipeline commented out. After yam, this is formatted as:

package:
  name: example
  version: 0.0.1
  epoch: 0
  description: Example app

pipeline:
  - uses: git-checkout
    with:
      repository: https://github.com/example/example
      tag: v${{package.version}}
      expected-commit: testabc

  - uses
    # NOTE: commented out command
    # - runs: |
    #     make target: go/build
    with:
      tags: "test"

Which is an invalid YAML file.

Similar error happened in a run for linter in https://github.com/wolfi-dev/os here: https://github.com/wolfi-dev/os/actions/runs/11252322016/job/31285172681

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

No branches or pull requests

1 participant