Skip to content

Commit

Permalink
Merge pull request #118 from davidcornu/david/check-stylelint-exit-code
Browse files Browse the repository at this point in the history
Check the `stylelint` exit code before proceeding
  • Loading branch information
bert-mccutchen authored Feb 8, 2024
2 parents 324e65f + fa1f186 commit eadef3f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ echo "stylelint version: $(npx --no-install -c 'stylelint --version')"

echo '::group:: Running stylelint with reviewdog 🐶 ...'
stylelint_results=$(__run_stylelint)

# stylelint exit codes are documented here:
# https://stylelint.io/user-guide/cli/#exit-codes
stylelint_rc=$?
if [ $stylelint_rc -ne 0 ] && [ $stylelint_rc -ne 2 ]; then
echo 'stylelint failed'
echo "${stylelint_results}"
echo '::endgroup::'
exit $stylelint_rc
fi

echo "${stylelint_results}" | __run_reviewdog

reviewdog_rc=$?
Expand Down

0 comments on commit eadef3f

Please sign in to comment.