Skip to content

Commit

Permalink
Fix excludes - use 'grep -v' instead of --exclude.
Browse files Browse the repository at this point in the history
  • Loading branch information
kportertx committed Nov 12, 2022
1 parent 1b07070 commit 187ab2b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

EXCLUDES=""
for exclude_path in $INPUT_EXCLUDE; do
EXCLUDES="$EXCLUDES --exclude='!$exclude_path'"
if [ -n "$EXCLUDES" ]; then
EXCLUDES="$EXCLUDES|$exclude_path"
else
EXCLUDES="$exclude_path"
fi
done

IGNORE_LIST=""
Expand All @@ -31,7 +35,7 @@ done
INPUT_HADOLINT_FLAGS="$INPUT_HADOLINT_FLAGS $IGNORE_LIST"

echo '::group:: Running hadolint with reviewdog 🐶 ...'
git ls-files --exclude='*Dockerfile*' --ignored --cached ${EXCLUDES} \
git ls-files --exclude='*Dockerfile*' --ignored --cached | grep -Ev "$EXCLUDES" \
| xargs hadolint -f json ${INPUT_HADOLINT_FLAGS} \
| jq -f "${GITHUB_ACTION_PATH}/to-rdjson.jq" -c \
| reviewdog -f="rdjson" \
Expand Down

0 comments on commit 187ab2b

Please sign in to comment.