Skip to content

Commit

Permalink
Merge pull request #10724 from cl8n/xargs
Browse files Browse the repository at this point in the history
Use NUL as separator for input to `xargs`
  • Loading branch information
TicClick authored Dec 29, 2023
2 parents 73d4f1d + 81ae735 commit 943241d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
- name: detect changed files
run: |
changed_files="$(mktemp)"
git diff --diff-filter=d --name-only --no-renames master >"$changed_files"
git diff --diff-filter=d --name-only --no-renames -z master >"$changed_files"
printf 'CHANGED_FILES=%s\n' "$changed_files" >>"$GITHUB_ENV"
- name: check file sizes
run: xargs -r meta/check-file-sizes.sh <"$CHANGED_FILES"
run: xargs -0r meta/check-file-sizes.sh <"$CHANGED_FILES"

- name: set up Node.js
id: setup-node
Expand All @@ -52,8 +52,8 @@ jobs:
- name: run remark on changed files
if: ${{ !contains(github.event.pull_request.body, 'SKIP_REMARK') }}
run: |
grep '\.md$' <"$CHANGED_FILES" | \
REPORTER=vfile-reporter-github-action xargs -r meta/remark.sh
grep -z '\.md$' <"$CHANGED_FILES" | \
REPORTER=vfile-reporter-github-action xargs -0r meta/remark.sh
- name: set up Python
uses: actions/setup-python@v4
Expand Down
18 changes: 9 additions & 9 deletions meta/check-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ run_test() {

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

changed_files="$(
{
git diff --diff-filter=d --name-only --no-renames master
git ls-files --exclude-standard --others
} | sort -u
)"

printf '%s\n' "$changed_files" | run_test 'file size' xargs -r meta/check-file-sizes.sh
printf '%s\n' "$changed_files" | grep '\.md$' | run_test Remark xargs -r meta/remark.sh
changed_files="$(mktemp)"
{
git diff --diff-filter=d --name-only --no-renames -z master
git ls-files --exclude-standard --others -z
} | \
sort -uz >"$changed_files"

run_test 'file size' xargs -0r meta/check-file-sizes.sh <"$changed_files"
grep -z '\.md$' <"$changed_files" | run_test Remark xargs -0r meta/remark.sh
run_test 'YAML style' osu-wiki-tools check-yaml
run_test link osu-wiki-tools check-links --all

Expand Down

0 comments on commit 943241d

Please sign in to comment.