Search code examples
githubgithub-actions

Github Action Status check missing from the list of checks in Protected branch settings


I have the following github action setup that triggers fine on creation of Pull Request. But it does not show up in the status checks list of protected branch (main). I'm not sure what I'm doing wrong.


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/[email protected]
    - name: Github Action for pytest
      run: python3 testing.py

I've also tried the same setting with:

on: [ pull_request ]

Edit: Screenshot of the check missing: enter image description here


Solution

  • Finally figured this out. I did not set a name for the job, so it defaulted to the property, build, in this case. I was searching by workflow name. Once I added the job name, I was able to search for it correctly. Later I also verified that searching for "build" brings up the check name in the list too.

    jobs:
      build:
        name: python test
    ...