Skip to content

Commit

Permalink
Do not lint when DIFF_BASE is provided and no Swift files where changed
Browse files Browse the repository at this point in the history
  • Loading branch information
axelguilmin committed Jan 25, 2020
1 parent a6fa1b1 commit 68744bd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ function convertToGitHubActionsLoggingCommands() {

if ! ${DIFF_BASE+false};
then
changedFiles="-- "
changedFiles+=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift')
changedFiles=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift')

if [ -z "$changedFiles" ]
then
echo "No Swift file changed"
exit
fi
fi

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

0 comments on commit 68744bd

Please sign in to comment.