-
Notifications
You must be signed in to change notification settings - Fork 0
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
ci: add linting for yml files #22
Conversation
I'm surprised. Usually yamlfmt is not used for limiting. You will find quite GitHub action for that, it may explain why you had to do the trick to install the latest version Usually, yamlint is the one used for linting. Any reason for that? |
- name: Get yamlfmt | ||
run: | | ||
LATEST_VERSION=$(curl -s https://api.github.com/repos/google/yamlfmt/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's/^v//') | ||
./.github/scripts/get-yamlfmt.sh "Linux" "x86_64" "$LATEST_VERSION" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could have used
go install github.com/google/yamlfmt/cmd/yamlfmt@latest
It would have been simpler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I did in the beginning, but setting up the whole go toolchain just to able to use a binary seemed a bit wrong (after all, being able to just use them directly is a major benefit of statically linked binaries, no?).
The best solution for this would be a github action as a wrapper for the installation process. Might create that if I get the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked for yamlfmt action and it's very disappointing
https://github.com/yk-lab/yamlfmt-action
Or this disappointing one
https://github.com/credfeto/action-yaml-format
The reformat is a sed 😂
I found this one, but yes it use setup-go then install it
https://github.com/norwd/fmtya
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, yeah, it's slim pickings for this tool.
I did find https://github.com/supplypike/setup-bin which does work for simply downloading the binary files and putting the in $PATH
, but then I lose checksum and signing (if applicable) validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And https://github.com/jaxxstorm/action-install-gh-release works well too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess there is no silver bullet for this use case as the validation steps can be quite varied across repositories.
Well, you would use the same tool for formatting and linting, no? Between the choice between yamlfmt and yamllint, I went with the former because: a. It's written in go, so easier to install locally, and should (theoretically) be faster |
No description provided.