Skip to content

Commit

Permalink
added optional debug
Browse files Browse the repository at this point in the history
  • Loading branch information
fearphage committed Mar 1, 2019
1 parent a369adb commit ebeca1e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ if [ -z "$GITHUB_SHA" ]; then
exit 1
fi

debug() {
if [ -n "$DEBUG_ACTION" ]; then
>&2 echo "DEBUG: $1"
fi
}

parse_json() {
jq --arg name "$GITHUB_ACTION" --arg now "$(timestamp)" '{
completed_at: $now,
Expand Down Expand Up @@ -80,6 +86,7 @@ main() {
local id
local json
local response
local results
local url

# github doesn't provide this URL so we have to create it
Expand All @@ -95,10 +102,21 @@ main() {
exit 78
fi

json=$(run_shellcheck | parse_json)
results="$(run_shellcheck)"

debug "shellcheck results => $results"

json=$(echo "$results" | parse_json)

debug "final json => $json"

# update check with results
request "$url" "$json" "$id"

# failure means errors occurred (warnings are ignored)
if [ "$(echo "$json" | jq --raw-output .conclusion)" = "failure" ]; then
exit 1
fi
}

main "$@"

0 comments on commit ebeca1e

Please sign in to comment.