Eyal Gerber
Eyal Gerber

Reputation: 1657

How to set Github Actions as Required Status Checks

I would like to set my GitHub Actions as required status checks so that I would be able to have protected branches and prevent commits from being pushed to specific branches if they don’t pass the github actions checks. But when I go to the branch protection rules, the github actions don’t appear in the list of checks to choose from: Repository Branch Protection Rules Do Not Show GitHub Actions

As you can see here I do have two github actions that have been running for several weeks on my repo:

GitHub Actions That Exist in the Repository

So am I missing something? How do I set Github Actions as required status checks?

Upvotes: 32

Views: 15946

Answers (2)

Ravi Sevta
Ravi Sevta

Reputation: 3075

Give a name to a Job

jobs:
  build:
    name: Code Formatting

otherwise, it gives a build as a default name

And on the setting page, it gives suggestions whenever you start searching by job name.

Upvotes: 7

Nikolay Kreshchuk
Nikolay Kreshchuk

Reputation: 396

You can still find your status check at search by name of the GitHub action job.

name: .NET

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    etc...

Here is name of the job is build.

Search example

Upvotes: 38

Related Questions