@@ -291,6 +291,7 @@ jobs:
291291
292292 fi;
293293
294+
294295 echo "Exit code was $EXITCODE";
295296
296297 if [ "${EXITCODE}" ]; then
@@ -306,29 +307,121 @@ jobs:
306307 echo "Exit code was ${EXITCODE}";
307308
308309
309- - name : Fail on Error
310- if : steps.lint.outputs.exit_code == 1
310+
311+ - name : Lint ${{ matrix.python-version }} Bitwise check exit code
312+ id : lint-exit-type
313+ if : inputs.LINT && needs.init.outputs.py-any-changed
311314 shell : bash
315+ env :
316+ EXITCODE : ${{ steps.lint.outputs.exit_code }}
312317 run : |
313- echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
318+ # Check error code for exit type
319+ # https://pylint.pycqa.org/en/latest/user_guide/usage/run.html#exit-codes
320+
321+ if (( $EXITCODE & 1 )); then
322+
323+ echo "fatal=true" >> $GITHUB_OUTPUT
324+
325+ else
326+
327+ echo "fatal=false" >> $GITHUB_OUTPUT
328+
329+ fi
330+
331+
332+ if (( $EXITCODE & 2 )); then
333+
334+ echo "error=true" >> $GITHUB_OUTPUT
335+
336+ else
337+
338+ echo "error=false" >> $GITHUB_OUTPUT
339+
340+ fi
341+
342+
343+ if (( $EXITCODE & 4 )); then
344+
345+ echo "warning=true" >> $GITHUB_OUTPUT
346+
347+ else
348+
349+ echo "warning=false" >> $GITHUB_OUTPUT
350+
351+ fi
352+
353+
354+ if (( $EXITCODE & 8 )); then
355+
356+ echo "refactor=true" >> $GITHUB_OUTPUT
357+
358+ else
359+
360+ echo "refactor=false" >> $GITHUB_OUTPUT
361+
362+ fi
363+
364+
365+ if (( $EXITCODE & 16 )); then
366+
367+ echo "convention=true" >> $GITHUB_OUTPUT
368+
369+ else
370+
371+ echo "convention=false" >> $GITHUB_OUTPUT
372+
373+ fi
374+
375+
376+ if (( $EXITCODE & 32 )); then
377+
378+ echo "usage_error=true" >> $GITHUB_OUTPUT
379+
380+ else
381+
382+ echo "usage_error=false" >> $GITHUB_OUTPUT
383+
384+ fi
385+
314386
315387
316388 - name : Fail on Fatal
317- if : steps.lint.outputs.exit_code == 2
389+ if : steps.lint-exit-type.outputs.fatal == "true"
390+ shell : bash
391+ run : |
392+ echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
393+
394+
395+ - name : Fail on Error
396+ if : steps.lint-exit-type.outputs.error == "true"
318397 shell : bash
319398 run : |
320399 echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
321400
322401
323402 - name : Fail on Warning
324- if : inputs.LINT_ERROR_ON_WARNING && steps.lint.outputs.exit_code == 4
403+ if : steps.lint-exit-type.outputs.warning == "true"
404+ shell : bash
405+ run : |
406+ echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
407+
408+
409+ - name : Fail on Refactor
410+ if : steps.lint-exit-type.outputs.refactor == "true"
411+ shell : bash
412+ run : |
413+ echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
414+
415+
416+ - name : Fail on Convention
417+ if : steps.lint-exit-type.outputs.convention == "true"
325418 shell : bash
326419 run : |
327420 echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
328421
329422
330423 - name : Fail on Usage Error
331- if : steps.lint.outputs.exit_code == 32
424+ if : steps.lint-exit-type .outputs.usage_error == "true"
332425 shell : bash
333426 run : |
334427 echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
0 commit comments