Skip to content

Commit

Permalink
Make error message friendly (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
maruloop authored Jun 3, 2024
1 parent e255763 commit 0fe948f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}" \
Expand Down

0 comments on commit 0fe948f

Please sign in to comment.