feat(actions): added YAML linting action using yamlfmt, and linted existing YAML files#6075
Conversation
… in github actions, and retain single line breaks
|
Hi @tombch this is amazing! if the github actions are hard to do you can start with excluding them and we can add them in a later PR - thanks for finding this and working on it! |
yamlfmt, and linted exist YAML filesyamlfmt, and linted existing YAML files
|
Claude finished @tombch's task in 2m 9s —— View job Code Review
Overall this is a clean, well-scoped addition. The Two things worth addressing:
The YAML formatting changes themselves look correct — the indentation fixes in the |
anna-parker
left a comment
There was a problem hiding this comment.
lgtm! I would maybe pin to a specific ymlfmt version as suggested to not have main tests potentially go red as soon as there is a new release :-)
This PR adds an action
yamlfmt-lintwhich checks for correctly formatted YAML, for all YAML files excluding the helm templates and Github actions.The linting is done using yamlfmt, and a couple of settings have been added in the
.yamlfmt.yml:trim_trailing_whitespace: true: trims trailing whitespace, and was required to preserve multiline script/run tags in GitHub actions (mentioned here: Multiline syntax with pipe (|) not retained google/yamlfmt#185).retain_line_breaks_single: true: any instance of multiple line breaks is squashed down into a single line break.Any suggestions for this are very welcome! Some caveats I have noticed with the formatting is that it does not preserve any indenting/aligning within comments (mentioned here: google/yamlfmt#290)
For the Github actions, it forces any run/script tags to use(Github actions are now excluded from linting)|-rather than|. Possibly the workflows shouldn't be included in linting?PR Checklist
🚀 Preview: Add
previewlabel to enable