我正在Mac-os-11上运行任务。我已经在本地集成了SwiftLint,并且它工作正常。但是,当有人提出PR时,我需要在GitHub actions中运行SwiftLint。我该如何做到这一点?以下是当前的yml文件。
name: Build & Test
on:
# Run tests when PRs are created or updated
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
env:
# Defines the Xcode version
DEVELOPER_DIR: /Applications/Xcode_13.0.app/Contents/Developer
FETCH_DEPTH: 0
RUBY_VERSION: 2.7.1
defaults:
run:
shell: bash
jobs:
test:
name: Build & Test
if: ${{ github.event.pull_request.draft == false }}
runs-on: macos-11
steps:
- name: Checkout Project
uses: actions/checkout@v2.3.4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Restore Gem Cache
uses: actions/cache@v2.1.3
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-
- name: Restore Pod Cache
uses: actions/cache@v2.1.3
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-
- name: Setup Ruby
uses: ruby/setup-ruby@v1.51.1
with:
bundler-cache: true
ruby-version: ${{ env.RUBY_VERSION }}
SwiftLint在本地工作正常,但是当我发起合并请求时,没有出现任何SwiftLint警告。
on.<pull_request|pull_request_target>.<branches|branches-ignore>
的参考文档 -- https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpull_requestpull_request_targetbranchesbranches-ignore - TechSolomon