diff --git a/.github/workflows/format-command.yml b/.github/workflows/format-command.yml index 51dfd4a25bd..a2544d7ffb1 100644 --- a/.github/workflows/format-command.yml +++ b/.github/workflows/format-command.yml @@ -40,8 +40,8 @@ jobs: - name: Commit to the PR branch if any changes run: | make format - find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec dos2unix {} \; - find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec chmod 644 {} \; + git ls-files -z | xargs -0 dos2unix --quiet + git ls-files -z | xargs -0 chmod 644 if [[ $(git ls-files -m) ]]; then git config --global user.name 'actions-bot' git config --global user.email '58130806+actions-bot@users.noreply.github.com' diff --git a/.github/workflows/style_checks.yaml b/.github/workflows/style_checks.yaml index 16b376455f9..87d95ce7913 100644 --- a/.github/workflows/style_checks.yaml +++ b/.github/workflows/style_checks.yaml @@ -43,13 +43,13 @@ jobs: - name: Ensure files use UNIX line breaks and have 644 permission run: | - find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec dos2unix --quiet {} \; - find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec chmod 644 {} \; + git ls-files -z | xargs -0 dos2unix --quiet + git ls-files -z | xargs -0 chmod 644 if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi - name: Ensure example scripts have at least one code block separator run: | - grep --files-without-match '# %%' $(find 'examples' -name '*.py') > output.txt + git ls-files 'examples/**/*.py' | xargs grep --files-without-match '# %%' > output.txt nfiles=$(wc --lines output.txt | awk '{print $1}') if [[ $nfiles > 0 ]]; then echo "Code block separator '# %%' is required in following example files:"