Skip to content

mayk-it/action-swiftlint

 
 

Repository files navigation

GitHub Action for SwiftLint

This Action executes SwiftLint and generates annotations from SwiftLint Violations.

Usage

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
      // Simple usage
      - name: GitHub Action for SwiftLint
        uses: mayk-it/action-swiftlint@3.2.2
      // With custom argument
      - name: GitHub Action for SwiftLint with --strict
        uses: mayk-it/action-swiftlint@3.2.2
        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: mayk-it/action-swiftlint@3.2.2
        env:
          DIFF_BASE: ${{ github.base_ref }}
          DIFF_HEAD: HEAD
      // Runs on different workspace
      - name: GitHub Action for SwiftLint (Different working directory)
        uses: mayk-it/action-swiftlint@3.2.2
        env:
          WORKING_DIRECTORY: Source

Secrets

  • Specifying GITHUB_TOKEN to secrets is required to using Check Run APIs for generating annotations from SwiftLint Violations.
  • Since 3.0.0, GITHUB_TOKEN is no longer needed.

Example

Here is an example that actually works. screenshot

Author

Norio Nomura (Modified By Jeremy Klein)

License

MIT

About

GitHub Action for SwiftLint

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 67.5%
  • Shell 22.2%
  • Dockerfile 10.3%