post_check๐Ÿ”—

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

title

Template

The title of the check.

summary

Template

The summary of the check.

success_conditions

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.

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 }} is True if all conditions matches otherwise False

  • {{ 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.

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.

../../_images/post-check-actions.png