Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix excludes - use 'grep -v' instead of --exclude. #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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