This Action executes SwiftLint and generates annotations from SwiftLint Violations by using GitHub Checks API.
An example workflow(.github/workflows/swiftlint.yml
) to executing SwiftLint follows:
name: SwiftLint
on:
pull_request:
paths:
- '.github/workflows/swiftlint.yml'
- '.swiftlint.yml'
- '**/*.swift'
jobs:
SwiftLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: GitHub Action for SwiftLint
# Avoid failing with "server error status: 403" on PR from forked repository
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
uses: norio-nomura/action-swiftlint@2.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Limitation: This action does not work with Pull Reuqest from forked repository, because GITHUB_TOKEN
used on that condition does not have write access to checks APIs.
- Specifying
GITHUB_TOKEN
tosecrets
is required to using Check Run APIs for generating annotations from SwiftLint Violations.
Here is an example that actually works.
Norio Nomura