Skip to content

Commit 943241d

Browse files
authored
Merge pull request #10724 from cl8n/xargs
Use NUL as separator for input to `xargs`
2 parents 73d4f1d + 81ae735 commit 943241d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
- name: detect changed files
2626
run: |
2727
changed_files="$(mktemp)"
28-
git diff --diff-filter=d --name-only --no-renames master >"$changed_files"
28+
git diff --diff-filter=d --name-only --no-renames -z master >"$changed_files"
2929
printf 'CHANGED_FILES=%s\n' "$changed_files" >>"$GITHUB_ENV"
3030
3131
- name: check file sizes
32-
run: xargs -r meta/check-file-sizes.sh <"$CHANGED_FILES"
32+
run: xargs -0r meta/check-file-sizes.sh <"$CHANGED_FILES"
3333

3434
- name: set up Node.js
3535
id: setup-node
@@ -52,8 +52,8 @@ jobs:
5252
- name: run remark on changed files
5353
if: ${{ !contains(github.event.pull_request.body, 'SKIP_REMARK') }}
5454
run: |
55-
grep '\.md$' <"$CHANGED_FILES" | \
56-
REPORTER=vfile-reporter-github-action xargs -r meta/remark.sh
55+
grep -z '\.md$' <"$CHANGED_FILES" | \
56+
REPORTER=vfile-reporter-github-action xargs -0r meta/remark.sh
5757
5858
- name: set up Python
5959
uses: actions/setup-python@v4

meta/check-all.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ run_test() {
4444

4545
cd -- "$(dirname "$0")/.."
4646

47-
changed_files="$(
48-
{
49-
git diff --diff-filter=d --name-only --no-renames master
50-
git ls-files --exclude-standard --others
51-
} | sort -u
52-
)"
53-
54-
printf '%s\n' "$changed_files" | run_test 'file size' xargs -r meta/check-file-sizes.sh
55-
printf '%s\n' "$changed_files" | grep '\.md$' | run_test Remark xargs -r meta/remark.sh
47+
changed_files="$(mktemp)"
48+
{
49+
git diff --diff-filter=d --name-only --no-renames -z master
50+
git ls-files --exclude-standard --others -z
51+
} | \
52+
sort -uz >"$changed_files"
53+
54+
run_test 'file size' xargs -0r meta/check-file-sizes.sh <"$changed_files"
55+
grep -z '\.md$' <"$changed_files" | run_test Remark xargs -0r meta/remark.sh
5656
run_test 'YAML style' osu-wiki-tools check-yaml
5757
run_test link osu-wiki-tools check-links --all
5858

0 commit comments

Comments
 (0)