受保护分支设置中的检查列表中缺少 Github 操作状态检查

时间:2021-07-28 05:13:57

标签: github github-actions

我有以下 github 操作设置,可以在创建拉取请求时很好地触发。但它没有显示在受保护分支(主)的状态检查列表中。我不确定我做错了什么。


name: Python application

on:
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python 3.7
      uses: actions/setup-python@v1
      with:
        python-version: 3.7
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
    - name: Lint with flake8
      run: |
        pip install flake8
        # stop the build if there are Python syntax errors or undefined names
        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
    - name: GitHub Action for pylint
      uses: cclauss/GitHub-Action-for-pylint@0.7.0
    - name: Github Action for pytest
      run: python3 testing.py

我也尝试了相同的设置:

on: [ pull_request ]

编辑: 支票缺失的截图: enter image description here

2 个答案:

答案 0 :(得分:2)

终于想通了。我没有为作业设置名称,因此在这种情况下它默认为属性构建。我正在按工作流名称搜索。一旦我添加了工作名称,我就能够正确搜索它。后来我也验证了搜索 build 也会在列表中显示检查名称。

jobs:
  build:
    name: python test
...

答案 1 :(得分:0)

浏览器的一种可能途径是添加 action commit-status-updater,以便为自己设置所需的状态检查。

<块引用>

一个简单的 Github Action,允许我们更新提交的状态。

GitHub 在运行工作流时不会更新提交的状态,因此依赖于给定提交的上下文/状态的工具与其不兼容。

目前支持 pull_request 和 push 事件:

  • 当事件为 pull_request 时,操作会将状态设置为触发工作流时拉取请求中的最后一次提交。
  • 当事件为推送时,该操作会将状态设置为触发工作流时推送的最后一次提交。
相关问题