post_check๐
Feature ๐
The post_check
action adds an item in a pull request check list. The check
status is success
when all conditions match, otherwise, it is set to
failure
.
Options๐
Key Name |
Value Type |
Default |
Value Description |
---|---|---|---|
|
list of conditions |
List of conditions to match to mark the pull request check as succeeded, otherwise, it will be marked as failing. If unset, the conditions from the rule that triggers this action are used. |
|
|
The summary of the check. |
||
|
The title of the check. |
As the title
and summary
use on Template, you can
benefit from any pull request attributes, e.g. {{author}}
, and also these
additional variables:
{{ check_rule_name }}
the name of the rule that triggered this action.
{{ check_succeed }}
isTrue
if all conditions matches otherwiseFalse
{{ check_conditions }}
the list of all conditions with a checkbox marked if the condition match
Examples๐
๐ Enforcing Conventional Commits๐
You might want to enforce some guidelines as how to write pull request title. The following rules add such a check, making sure your team follows Conventional Commits.
The check will be posted only on pull requests targeting the main branch. The check conclusion will be a success if the title contains a conventional commit type, otherwise it will be a failure.
pull_request_rules:
- name: Conventional Commit
conditions:
- base=main
actions:
post_check:
success_conditions:
- "title~=^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\\(.+\\))?:"
title: |
{% if check_succeed %}
Title follows Conventional Commit
{% else %}
Title does not follow Conventional Commit
{% endif %}
summary: |
{% if not check_succeed %}
Your pull request title must follow [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/).
{% endif %}
The result of this check will be visible in GitHub user interface, near the merge button.
