From c8034a356a4b22ba83540b8041ec2c06a08adfaa Mon Sep 17 00:00:00 2001 From: Masaya Suzuki <15100604+massongit@users.noreply.github.com> Date: Sun, 12 Jan 2025 13:05:07 +0900 Subject: [PATCH] Parse the severity if the output is from shellcheck --- entrypoint.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index ba99b58..8abc190 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,9 +12,22 @@ fi export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" # shellcheck disable=SC2086 -actionlint -oneline ${INPUT_ACTIONLINT_FLAGS} \ +actionlint -oneline ${INPUT_ACTIONLINT_FLAGS} | while read -r r; do + shellcheck_output=" shellcheck reported issue in this script: " + severity=e + + # Parse the severity if the output is from shellcheck + if echo "${r}" | grep "${shellcheck_output}"; then + s="$(echo "${r}" | sed -e "s/^.*${shellcheck_output}[^:]*:\([^:]\).*$/\1/g")" + if [ "${s}" = 'e' ] || [ "${s}" = 'w' ] || [ "${s}" = 'i' ] || [ "${s}" = 'n' ]; then + severity="${s}" + fi + fi + + echo "${severity}:${r}" +done \ | reviewdog \ - -efm="%f:%l:%c: %m" \ + -efm="%t:%f:%l:%c: %m" \ -name="${INPUT_TOOL_NAME}" \ -reporter="${INPUT_REPORTER}" \ -filter-mode="${INPUT_FILTER_MODE}" \