Status Check
A Branch Protection Rule or Ruleset allows to reference certain status checks that are required to pass before a pull request can be merged into the target branch.
Source | Format | Example |
---|---|---|
Workflow | <job-name> |
Run CI |
App | <app-slug>:<status-name> |
eclipse-eca-validation:eclipsefdn/eca |
Any | any:<status-name> |
any:Run CI |
Note
Rulesets do not make any distinction between Any
or Workflow
as source and thus
specifying any:
is not needed for them and will give the same result as omitting it.
Workflows as Required Status Checks¶
Given the following workflows ci.yaml
and job-legal.yaml
in a GitHub repository:
Based on these workflow files, the following status checks would be available:
build
: references the job build in the ci workflow by its id as it has no name specifiedtesting
: references the job test in the ci workflow by its name testingcall-legal / Legal Checks
: references the job legal by its nameLegal Checks
in the workflow job-legal.yaml that is called from the job legal in the ci workflow
Rules for translating jobs to stats-checks:
- if a job has no name specified, use its id
- if reusable workflows are called, join the jobs in their call hierarchy with
/
Note
Be aware of the mandatory whitespaces surrounding the /
. In case they are omitted, the status check will not
be correctly recognized by GitHub. Please refer also the example outlined above.
Now, as an example to protect the main
branch by enforcing specific status checks to pass before a pull request can be merged into it,
you can add the status checks as below: