Skip to content

Commit 0c1fb98

Browse files
tools: add message on auto-fixing js lint issues in gh workflow
PR-URL: #59128 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 7c85aa5 commit 0c1fb98

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/linters.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,31 @@ jobs:
103103
- name: Environment Information
104104
run: npx envinfo
105105
- name: Lint JavaScript files
106-
run: NODE=$(command -v node) make lint-js
106+
run: |
107+
set +e
108+
NODE=$(command -v node) make lint-js
109+
EXIT_CODE="$?"
110+
if [ "$EXIT_CODE" != "0" ]; then
111+
echo
112+
echo 'ERROR: The JavaScript lint validation failed (the errors are logged above).'
113+
echo ' Please fix the lint errors.'
114+
if NODE=$(command -v node) make lint-js-fix > /dev/null 2>&1; then
115+
echo ' Run:'
116+
echo ' make lint-js-fix'
117+
echo ' to fix the lint issues.'
118+
git --no-pager diff
119+
elif git diff --quiet --exit-code; then
120+
echo ' None of the issue is auto-fixable, so manual fixes for'
121+
echo ' all of the issues are required.'
122+
else
123+
echo ' Run:'
124+
echo ' make lint-js-fix'
125+
echo ' to fix the auto-fixable lint issues.'
126+
echo ' Note that some manual fixes are also required.'
127+
fi
128+
echo
129+
exit "$EXIT_CODE"
130+
fi
107131
- name: Get release version numbers
108132
if: ${{ github.event.pull_request && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch }}
109133
id: get-released-versions

0 commit comments

Comments
 (0)