Skip to content

Commit 68744bd

Browse files
committed
Do not lint when DIFF_BASE is provided and no Swift files where changed
1 parent a6fa1b1 commit 68744bd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: entrypoint.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ function convertToGitHubActionsLoggingCommands() {
1313

1414
if ! ${DIFF_BASE+false};
1515
then
16-
changedFiles="-- "
17-
changedFiles+=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift')
16+
changedFiles=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift')
17+
18+
if [ -z "$changedFiles" ]
19+
then
20+
echo "No Swift file changed"
21+
exit
22+
fi
1823
fi
1924

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

0 commit comments

Comments
 (0)