Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
// Simple usage
- name: GitHub Action for SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1
// With custom argument
- name: GitHub Action for SwiftLint with --strict
uses: norio-nomura/action-swiftlint@3.2.1
with:
args: --strict
// Only checks files changed in the PR
- name: Fetch base ref
run: |
git fetch --prune --no-tags --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/heads/${{ github.base_ref }}
- name: GitHub Action for SwiftLint (Only files changed in the PR)
uses: norio-nomura/action-swiftlint@3.2.1
env:
DIFF_BASE: ${{ github.base_ref }}
DIFF_HEAD: HEAD
// Runs on different workspace
- name: GitHub Action for SwiftLint (Different working directory)
uses: norio-nomura/action-swiftlint@3.2.1
env:
Expand Down
11 changes: 9 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ then
cd ${WORKING_DIRECTORY}
fi

if ! ${DIFF_BASE+false};
then
if [ -n "$DIFF_BASE" ] && [ -n "$DIFF_HEAD" ]; then
changedFiles=$(git --no-pager diff --name-only --relative $DIFF_HEAD $DIFF_BASE -- '*.swift')

if [ -z "$changedFiles" ]
then
echo "No Swift file changed"
exit
fi
elif [ -n "$DIFF_BASE" ]; then
changedFiles=$(git --no-pager diff --name-only --relative FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift')

if [ -z "$changedFiles" ]
Expand Down