From cbec26873dff6c8c713b33de38f58160a0af95c2 Mon Sep 17 00:00:00 2001 From: Shunsuke Suzuki Date: Wed, 27 Nov 2024 10:35:13 +0900 Subject: [PATCH] fix: replace RENOVATE_CONFIG_FILE with positional arguments (#772) * fix: replace RENOVATE_CONFIG_FILE with positional arguments * fix: fix arguments * fix: replace newlines with spaces * refactor: remove an unused variable --- action.yaml | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/action.yaml b/action.yaml index dd92de4..244edca 100644 --- a/action.yaml +++ b/action.yaml @@ -43,7 +43,7 @@ runs: if [ "$STRICT" = "true" ]; then opts=--strict elif [ "$STRICT" != "false" ]; then - echo "::error:: the input 'strict' must be \"true\" or \"false\"" + echo '::error:: the input "strict" must be "true" or "false"' exit 1 fi @@ -52,29 +52,25 @@ runs: fi if [ -n "$CONFIG_FILE_PATH" ]; then - while read -r file; do - if [ -z "$file" ]; then - continue - fi - echo "===> npx --yes --package \"$pkg\" -c \"renovate-config-validator $opts $file\"" >&2 - npx --yes --package "$pkg" -c "renovate-config-validator $opts $file" - done < <(echo "$CONFIG_FILE_PATH") + files=$(echo "$CONFIG_FILE_PATH" | tr '\n' ' ') + echo "===> npx --yes --package \"$pkg\" -c \"renovate-config-validator $opts $files\"" >&2 + npx --yes --package "$pkg" -c "renovate-config-validator $opts $files" exit 0 - else + fi - missing=true - for file in .github/renovate.json .github/renovate.json5 .gitlab/renovate.json .gitlab/renovate.json5 .renovaterc.json .renovaterc.json5 renovate.json renovate.json5 .renovaterc; do - if [ -f "$file" ]; then - missing=false - echo "===> npx --yes --package \"$pkg\" -c \"renovate-config-validator $opts $file\"" >&2 - echo "===> RENOVATE_CONFIG_FILE=\"$file\" npx --yes --package \"$pkg\" -c \"renovate-config-validator $opts\"" >&2 - npx --yes --package "$pkg" -c "renovate-config-validator $opts $file" - fi - done - if [ "$missing" = "true" ]; then - echo "===> No configuration file is found" >&2 + files="" + for file in .github/renovate.json .github/renovate.json5 .gitlab/renovate.json .gitlab/renovate.json5 .renovaterc.json .renovaterc.json5 renovate.json renovate.json5 .renovaterc; do + if [ -f "$file" ]; then + files="$files $file" fi + done + if [ -z "$files" ]; then + echo "===> No configuration file is found" >&2 + exit 0 fi + + echo "===> npx --yes --package \"$pkg\" -c \"renovate-config-validator $opts $files\"" >&2 + npx --yes --package "$pkg" -c "renovate-config-validator $opts $files" shell: bash env: VALIDATOR_VERSION: ${{inputs.validator_version}}