Approval rules in SourceCraft

With SourceCraft, you can flexibly set up mandatory approval rules before any code can be added to the target branch of the repository.

If a repository has the approval rules enabled, SourceCraft analyzes approvals from reviewers for compliance with the specified rules. If there are not enough approvals, merging the pull request with the target branch will be blocked.

Once you get all the approvals specified in the rules, you can merge the changes.

Only users with the Repository maintainer or Repository admin roles can bypass the approval rules and perform a forced merge.

The approval rule configuration is specified for a particular repository and stored in the root of the repository in a file named .src.ci.yaml.

Sample configuration

codereview: 
  need_ships: 1 # Required number of approvals from reviewers
  ignore_self_ship: false # Ignore approvals from the pull request author
  ignore_non_reviewers_block: false # Ignore pull request blocking from non-reviewers
  auto_assign: true # Automatically assign reviewers
  rules:
    - patterns:
        - '*'
      reviewers:
        usernames: 
          - "<user_name>" # List of reviewers
        assign: 1 # Number of automatically assigned reviewers
        need_ships: 1 # Required number of approvals from reviewers
        ignore_self_ship: false # Ignore approvals from the pull request author

See the templates repository in SourceCraft for the full specification of the .src.ci.yaml file.

See also