首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在拉请求SwiftLint操作上运行GitHub

在拉请求SwiftLint操作上运行GitHub
EN

Stack Overflow用户
提问于 2022-03-22 10:10:36
回答 1查看 797关注 0票数 2

我正在运行Mac-os-11上的作业。我也在本地集成了SwiftLint,这是很好的。但是,当有人提高pr时,我需要在SwiftLint上运行GitHub操作。我怎么能这么做。下面是用于操作的当前yml文件。

代码语言:javascript
复制
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警告。

EN

回答 1

Stack Overflow用户

发布于 2022-03-22 11:28:35

我使用这一步骤:

代码语言:javascript
复制
- name: Lint
        run: |
          set -o pipefail
          swiftlint lint --strict --quiet | sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 title=Lint error,file=\1,line=\2,col=\3::\5\n\1:\2:\3/'

它将迅捷的警告和错误解析为GitHub注释,这些注释可以立即在摘要中看到。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71570210

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档