From 7839ede089e483df865be448d6f3652f875005e0 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Thu, 5 Jan 2023 10:19:06 -0700 Subject: [PATCH] fix(regression): invalid json output. (#930) Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 1 - get-changed-paths.sh | 4 ++-- test/test/test.txt | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ccb41dc..3695c586 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,6 @@ name: CI on: push: branches: - - main - "**" pull_request: types: diff --git a/get-changed-paths.sh b/get-changed-paths.sh index 38a1972b..224d050f 100755 --- a/get-changed-paths.sh +++ b/get-changed-paths.sh @@ -52,13 +52,13 @@ function get_dirname_max_depth() { } function json_output() { - JQ_ARGS="-R" + JQ_ARGS="-sR" if [[ "$INPUT_JSON_RAW_FORMAT" == "true" ]]; then JQ_ARGS="$JQ_ARGS -r" fi # shellcheck disable=SC2086 - jq $JQ_ARGS 'split("\n") | @json' | tr -s / + jq $JQ_ARGS 'split("\n") | map(select(. != "")) | @json' | sed -r 's/^"|"$//g' | tr -s / } function get_diff() { diff --git a/test/test/test.txt b/test/test/test.txt index 9f4b6d8b..6de7b8c6 100644 --- a/test/test/test.txt +++ b/test/test/test.txt @@ -1 +1 @@ -This is a test file +This is a test file.