Linter error #47
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pr-workflow | |
on: | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- '.github/workflows/swiftlint.yml' | |
- '.swiftlint.yml' | |
- '**/*.swift' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
swiftLint: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/realm/swiftlint:5.5-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Get Changed Files | |
id: get_changed_files | |
run: | | |
base_branch=main | |
echo "::set-output name=files::$(git diff --name-only $base_branch ${{ github.sha }} | grep '\.swift$' || true)" | |
# Runs a single command using the runners shell | |
- name: Run SwiftLint on Changed Files | |
run: | | |
if [ -n "${{ steps.get_changed_files.outputs.files }}" ]; then | |
swiftlint --path "${{ steps.get_changed_files.outputs.files }}" | |
else | |
echo "No Swift files changed." | |
fi |