From d6f900647b95358ada23f5777b99490c910669db Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 16 Mar 2020 15:39:37 -0300 Subject: [PATCH] Fixed trailing-newlines.sh not failing when rg is not installed --- .github/scripts/trailing-newlines.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/scripts/trailing-newlines.sh b/.github/scripts/trailing-newlines.sh index e2009df8c..b5fc4bac4 100755 --- a/.github/scripts/trailing-newlines.sh +++ b/.github/scripts/trailing-newlines.sh @@ -1,8 +1,12 @@ #!/bin/bash -set -e +set -eo pipefail -files=$(rg -l '[^\n]\z' -g '!*.{svg,scss,json}' || true) +# Checking version to force it fail the build if rg is not installed. +# Because `set -e` does not work inside the subshell $() +rg --version + +files=$(rg -l '[^\n]\z' -g '!*.{png,svg,scss,json}' || true) if [ "$files" != "" ]; then echo "the following files are missing a newline on the last line:" echo $files