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
chore: Make YAML workflow git-based #7477
Conversation
- '**.y?ml' | ||
- '**.yml' | ||
- '**.yaml' |
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.
Explicit is better than implicit.
@@ -21,4 +23,4 @@ jobs: | |||
uses: actions/checkout@v4 | |||
|
|||
- name: Run yamllint | |||
run: find . -path \*/vendor -prune -false -o -name \*.y*ml | xargs yamllint | |||
run: git ls-files --cached -z -- '*.y*ml' | xargs --null -- yamllint |
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.
Explanation:
-z
quotes filenames with special characters and separates each path with NUL byte (that's why when you call this in CLI you get one long string, instead of multiple lines)xargs --null
then handles this NUL byte and applies YAML linter to each file
I am not 100% sure if it's needed here, we could use git ls-files
without -z
and then xargs
would work on new lines. But both ways work, so 👍.
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 cannot take the risk of having space - or line end - characters in file names.
Sorry. My speciality is the unhappy path. I run (not build) things.
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.
Thanks @szepeviktor 🍻 |
Glad to contribute. |
find
works on the filesystem,git
works on git index.source