Skip to content

Commit

Permalink
Merge pull request #153 from reviewdog/massongit-patch-2
Browse files Browse the repository at this point in the history
Parse the severity if the output is from shellcheck
  • Loading branch information
massongit authored Jan 13, 2025
2 parents 7433739 + c8034a3 commit 9be0e56
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}" \
Expand Down

0 comments on commit 9be0e56

Please sign in to comment.