diff --git a/.github/workflows/validate-renovate.yml b/.github/workflows/validate-renovate.yml index 1ab091bd..be276455 100644 --- a/.github/workflows/validate-renovate.yml +++ b/.github/workflows/validate-renovate.yml @@ -28,10 +28,24 @@ jobs: echo "npx: $(npx --version)" echo "installing: $package..." export H="$(mktemp)" + se="$(mktemp)" echo '{' >> "$H" - # let's do main part, but avoid pipefail - (npx --yes --package "$package" -- renovate-config-validator --strict || true)\ - | ruby -e 'File.open(ENV[?H], ?a) {|r| while gets; puts $_; $> = r if $_.strip == "WARN: Config migration necessary" ;end; }' + js_output_temp="$(mktemp)" + npx --yes --package "$package" -- renovate-config-validator --strict >"$js_output_temp" || true + if grep -e "^ERROR: Found errors in configuration" "$js_output_temp"; then + # hard error + # TODO: collect this as JSON, and display it in more structured way + lf=$'\n' + { + echo '```' + echo "Error(s) has been occurred: ${lf}$(cat "$js_output_temp")" + echo '```' + } | gh pr comment -F - "${URL}" + exit 1 + fi + + # let's do main part, but avoid pipefail for soft-error about migration + ruby -e 'File.open(ENV[?H], ?a) {|r| while gets; puts $_; $> = r if $_.strip == "WARN: Config migration necessary" ;end; }' <"$js_output_temp" echo '}' >> "$H" # exit early if migration is not required