diff --git a/.github/workflows/scripts/validate-formatting.sh b/.github/workflows/scripts/validate-formatting.sh index d8c0274..acc71d1 100755 --- a/.github/workflows/scripts/validate-formatting.sh +++ b/.github/workflows/scripts/validate-formatting.sh @@ -14,7 +14,11 @@ # limitations under the License. set -e -if [[ $(git ls-files --modified) ]]; then +# Get modified files, excluding pubspec.lock. +# The '|| true' prevents the script from exiting if grep finds no matches. +MODIFIED_FILES=$(git ls-files --modified | grep -v '^pubspec.lock$' || true) + +if [[ $MODIFIED_FILES ]]; then echo "" echo "" echo "These files are not formatted correctly:"