mirror of
https://github.com/hadolint/hadolint-action.git
synced 2025-01-19 05:54:45 +01:00
feat: use 'set-output name=results'
This will introduce a parameter with name results that holds the hadolint output. Other steps in a workflow can make use of this. Also fix an error with the piping to tee that was broken.
This commit is contained in:
parent
83b3de1e17
commit
bc289f2eaa
1 changed files with 12 additions and 11 deletions
23
hadolint.sh
23
hadolint.sh
|
@ -23,25 +23,26 @@ if [ -z "$HADOLINT_TRUSTED_REGISTRIES" ]; then
|
||||||
unset HADOLINT_TRUSTED_REGISTRIES;
|
unset HADOLINT_TRUSTED_REGISTRIES;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OUTPUT=
|
|
||||||
if [ -n "$HADOLINT_OUTPUT" ]; then
|
|
||||||
if [ -f "$HADOLINT_OUTPUT" ]; then
|
|
||||||
HADOLINT_OUTPUT="$TMP_FOLDER/$HADOLINT_OUTPUT"
|
|
||||||
fi
|
|
||||||
OUTPUT=" | tee $HADOLINT_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
FAILED=0
|
|
||||||
if [ "$HADOLINT_RECURSIVE" = "true" ]; then
|
if [ "$HADOLINT_RECURSIVE" = "true" ]; then
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
|
|
||||||
filename="${!#}"
|
filename="${!#}"
|
||||||
flags="${@:1:$#-1}"
|
flags="${@:1:$#-1}"
|
||||||
|
|
||||||
hadolint $HADOLINT_CONFIG $flags **/$filename $OUTPUT || FAILED=1
|
RESULTS=$(hadolint $HADOLINT_CONFIG $flags **/$filename)
|
||||||
else
|
else
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
hadolint $HADOLINT_CONFIG "$@" $OUTPUT || FAILED=1
|
RESULTS=$(hadolint $HADOLINT_CONFIG "$@")
|
||||||
|
fi
|
||||||
|
FAILED=$?
|
||||||
|
|
||||||
|
echo "::set-output name=results::$RESULTS"
|
||||||
|
|
||||||
|
if [ -n "$HADOLINT_OUTPUT" ]; then
|
||||||
|
if [ -f "$HADOLINT_OUTPUT" ]; then
|
||||||
|
HADOLINT_OUTPUT="$TMP_FOLDER/$HADOLINT_OUTPUT"
|
||||||
|
fi
|
||||||
|
echo "$RESULTS" > $HADOLINT_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$HADOLINT_OUTPUT" ] || echo "Hadolint output saved to: $HADOLINT_OUTPUT"
|
[ -z "$HADOLINT_OUTPUT" ] || echo "Hadolint output saved to: $HADOLINT_OUTPUT"
|
||||||
|
|
Loading…
Add table
Reference in a new issue