Skip to content

Commit cf440cc

Browse files
committed
Catch known errors, turn into warnings and exit 0
1 parent 1233ff3 commit cf440cc

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

action.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,24 @@ runs:
116116
EXTRA_LINTER_SCRIPT_FLAGS=" --debug"
117117
fi
118118
119-
"${PYTHON_CMD}" "${GITHUB_ACTION_PATH}"/python_lint.py "${INPUTS_LINTER}" --target="${INPUTS_TARGET}" --output="${GITHUB_WORKSPACE}/${INPUTS_OUTPUT}" ${EXTRA_LINTER_SCRIPT_FLAGS} || ( echo "::error::${INPUTS_LINTER} failed to run for Python ${INPUTS_PYTHON_VERSION}" && exit 1 )
119+
"${PYTHON_CMD}" "${GITHUB_ACTION_PATH}"/python_lint.py "${INPUTS_LINTER}" --target="${INPUTS_TARGET}" --output="${GITHUB_WORKSPACE}/${INPUTS_OUTPUT}" ${EXTRA_LINTER_SCRIPT_FLAGS}
120+
121+
retval=$?
122+
123+
if [[ $retval -ne 0 ]]; then
124+
# don't fail "hard" if it's known failures that we cannot account for (yet)
125+
# pytype doesn't support 3.11+ yet
126+
if [[ "${INPUTS_LINTER}" == "pytype" -a "${INPUTS_PYTHON_VERSION}" =~ ^3\.(1[1-9]|[2-9][0-9]$ ]]; then
127+
echo "::warning::pytype failed to run for Python ${INPUTS_PYTHON_VERSION}; this is likely due to pytype not yet supporting Python ${INPUTS_PYTHON_VERSION}"
128+
exit 0
129+
# fixit>1 doesn't work for 3.7
130+
elif [[ "${INPUTS_LINTER}" == "fixit" -a "${INPUTS_PYTHON_VERSION}" == "3.7" ]]; then
131+
echo "::warning::fixit failed to run for Python ${INPUTS_PYTHON_VERSION}; this is likely due to fixit not supporting Python ${INPUTS_PYTHON_VERSION}"
132+
exit 0
133+
fi
134+
135+
echo "::error::${INPUTS_LINTER} failed to run for Python ${INPUTS_PYTHON_VERSION}" && exit 1
136+
fi
120137
else
121138
echo "::error::invalid linter ${INPUTS_LINTER}; choose one of ${linters[*]}"
122139
exit 1

0 commit comments

Comments
 (0)