From 0fe948fe0198d6bd177f3f67dea3e3a8b2fd0f71 Mon Sep 17 00:00:00 2001 From: maru Date: Mon, 3 Jun 2024 18:43:00 +0900 Subject: [PATCH] Make error message friendly (#25) --- entrypoint.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 4494fd3..f9cb670 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,10 +8,24 @@ fi export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" +jq_script=' +.diagnostics[] +| { + severity: (.severity|ascii_upcase), + message: "\(.summary)\n\(.detail)", + location: { + path: .range.filename, + range: { + start: (.range.start|{line, column}), + end: (.range.end|{line, column})}, + }, +} +' + terraform init -backend=false # shellcheck disable=SC2086 terraform validate -json \ - | jq -r '.diagnostics[] | "\(.range.filename):\(.range.start.line):\(.range.start.column): \(.detail)"' \ + | jq "$jq_script" -c \ | reviewdog -efm="%f:%l:%c:%m" \ -name="terraform validate" \ -reporter="${INPUT_REPORTER:-github-pr-check}" \