首页 > 解决方案 > 受保护的分支设置中的检查列表中缺少 Github 操作状态检查

问题描述

我有以下 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 ]

编辑:检查丢失的屏幕截图: 在此处输入图像描述

标签: githubgithub-actions

解决方案


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

jobs:
  build:
    name: python test
...

推荐阅读