Skip to content

Commit

Permalink
fix: resolve path to problem matcher
Browse files Browse the repository at this point in the history
If run as a composite action, we need to rely on `GITHUB_ACTION_PATH`
which defaults to unset (read: not in a composite action).
  • Loading branch information
jbergstroem committed Nov 8, 2022
1 parent 9157600 commit 31722f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ HADOLINT_PATH=${hadolint_path:-"hadolint"}
CI=${GITHUB_ACTIONS:-"false"}
# This variable is magic in workflows; it intercepts output and makes it availble across jobs
GITHUB_OUTPUT=${GITHUB_OUTPUT:-/dev/null}
MATCHER_PREFIX=${GITHUB_ACTION_PATH:-"~"}

function exit_with_error() {
echo "${1}"
Expand Down Expand Up @@ -42,7 +43,7 @@ function run() {
local CONFIG=""
[[ -z "${CONFIG_FILE}" ]] || CONFIG="-c ${CONFIG_FILE}"

[[ "${ANNOTATE}" == "true" ]] && [[ "${CI}" == "true" ]] && echo "::add-matcher::.github/problem-matcher.json"
[[ "${ANNOTATE}" == "true" ]] && [[ "${CI}" == "true" ]] && echo "::add-matcher::${MATCHER_PREFIX}/.github/problem-matcher.json"

# If output_format is passed, we unfortunately need to run hadolint twice due
# to how output formatting works.
Expand Down

0 comments on commit 31722f9

Please sign in to comment.