3

寻找一种方法来禁用 Github Actions 检查从注释文件中运行。

/* 上下文 - 使用 eslint 工作流操作来评论 PR,因为这个检查运行默认注释所有文件很烦人 */

参考 PR- https://github.com/tamdilip/ember_poc/pull/143/files

4

2 回答 2

3

当问题匹配器在日志中找到匹配项时,会添加注释。

例如。setup-node注册 eslint 问题匹配器。可以通过

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
  with:
    node-version: '12'
- run: |
       echo "::remove-matcher owner=eslint-compact::"
       echo "::remove-matcher owner=eslint-stylish::"

您也可以使用我编写的 eslint 操作,它在更改的文件上运行 linter。https://github.com/sibiraj-s/action-eslint。您可以通过传递输入参数来禁用注释annotations: false

name: Lint

on:
  pull_request:
  push:
    branches:
      - master

jobs:
  eslint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '14'
      - run: npm ci # or yarn install
      - uses: sibiraj-s/action-eslint@v1
        with:
          extensions: 'js, jsx, ts, tsx'
          annotations: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

在此处阅读有关问题匹配器的更多信息

https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers

用于在其他操作中禁用注释的中型文章。https://sibiraj-s.medium.com/disable-annotations-in-github-actions-ff938d5ea4f3

于 2021-01-30T04:45:43.693 回答
2

观察到终端控制台中的 CLI 错误日志会自动调用检查运行,这是注释的原因,因为这似乎是Github Action 本身的默认功能,并且无法通过任何配置禁用它。

暂时我设法通过侦听器分别捕获那些 CLI 日志输出为XML 格式来停止注释,而不是直接让错误登录终端控制台。

仍然应该提供从注释切换检查运行的配置级别选项。

于 2020-06-18T07:00:03.520 回答