Code-Quality scan with SwiftLint #219
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: "Code-Quality scan with SwiftLint" | |
on: | |
# Triggers the workflow on push or pull request events but only for default and protected branches | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
schedule: | |
- cron: '33 6 * * 1' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
scan-app: | |
name: Swift Lint Check | |
permissions: | |
# required for all workflows | |
security-events: write | |
# only required for workflows in private repositories | |
actions: read | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
# Sets up the reviewdog cli | |
- name: Setup reviewdog | |
uses: reviewdog/[email protected] | |
- name: Show reviewdog version | |
run: reviewdog -version | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout repository | |
uses: actions/[email protected] | |
# Performs analysis using Swift Lint and outputs a Sarif Report | |
- name: GitHub Action for SwiftLint | |
uses: stanfordbdhg/[email protected] | |
with: | |
args: --reporter sarif --output lint-results-debug.sarif | |
# https://github.com/realm/SwiftLint/issues/4048 | |
# Uploads Sarif Report for the app to GitHub | |
- name: Upload Swift app report | |
uses: github/codeql-action/[email protected] | |
if: success() || failure() | |
with: | |
sarif_file: lint-results-debug.sarif | |
# Process checkstyle Report file from Swift Lint with reviewdog cli | |
- name: Run reviewdog for app | |
if: success() || failure() | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: reviewdog -f=sarif -diff="git diff FETCH_HEAD" -name="lint" -reporter=github-pr-check < lint-results-debug.sarif |