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

Support filenames with spaces when using DIFF_BASE #42

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ fi

if ! ${DIFF_BASE+false};
then
changedFiles=$(git --no-pager diff --name-only --relative FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift')
changedFiles=$(
git --no-pager diff --name-only --relative FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift' \
| sed -E 's/^(.*)$/"\1"/'
)

if [ -z "$changedFiles" ]
then
Expand All @@ -31,4 +34,10 @@ then
fi
fi

set -o pipefail && swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands
set -o pipefail

if [ -z "$changedFiles" ]; then
swiftlint "$@" | stripPWD | convertToGitHubActionsLoggingCommands
else
echo $changedFiles | xargs swiftlint "$@" | stripPWD | convertToGitHubActionsLoggingCommands
fi