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

chore: Make YAML workflow git-based #7477

Merged
merged 1 commit into from Nov 26, 2023
Merged

Conversation

szepeviktor
Copy link
Contributor

@szepeviktor szepeviktor commented Nov 26, 2023

find works on the filesystem, git works on git index.

source

Comment on lines -6 to +7
- '**.y?ml'
- '**.yml'
- '**.yaml'
Copy link
Contributor Author

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
Copy link
Member

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 👍.

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we don't have files with spaces in name, but yeah, your approach is better here:

image

@coveralls
Copy link

Coverage Status

coverage: 94.922%. remained the same
when pulling 32d0398 on szepeviktor:patch-3
into e1672a4 on PHP-CS-Fixer:master.

@Wirone Wirone merged commit a95bb1b into PHP-CS-Fixer:master Nov 26, 2023
26 checks passed
@Wirone
Copy link
Member

Wirone commented Nov 26, 2023

Thanks @szepeviktor 🍻

@szepeviktor szepeviktor deleted the patch-3 branch November 26, 2023 18:27
@szepeviktor
Copy link
Contributor Author

Glad to contribute.

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

Successfully merging this pull request may close these issues.

None yet

3 participants