Skip to content

Commit ad4a8d1

Browse files
authored
CI: Use 'git ls-files' to list all git tracked files (#3055)
1 parent ab39616 commit ad4a8d1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.github/workflows/format-command.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ jobs:
4040
- name: Commit to the PR branch if any changes
4141
run: |
4242
make format
43-
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec dos2unix {} \;
44-
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec chmod 644 {} \;
43+
git ls-files -z | xargs -0 dos2unix --quiet
44+
git ls-files -z | xargs -0 chmod 644
4545
if [[ $(git ls-files -m) ]]; then
4646
git config --global user.name 'actions-bot'
4747
git config --global user.email '[email protected]'

.github/workflows/style_checks.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ jobs:
4343

4444
- name: Ensure files use UNIX line breaks and have 644 permission
4545
run: |
46-
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec dos2unix --quiet {} \;
47-
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec chmod 644 {} \;
46+
git ls-files -z | xargs -0 dos2unix --quiet
47+
git ls-files -z | xargs -0 chmod 644
4848
if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi
4949
5050
- name: Ensure example scripts have at least one code block separator
5151
run: |
52-
grep --files-without-match '# %%' $(find 'examples' -name '*.py') > output.txt
52+
git ls-files 'examples/**/*.py' | xargs grep --files-without-match '# %%' > output.txt
5353
nfiles=$(wc --lines output.txt | awk '{print $1}')
5454
if [[ $nfiles > 0 ]]; then
5555
echo "Code block separator '# %%' is required in following example files:"

0 commit comments

Comments
 (0)