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.

Warning

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

You specify the approval rule configuration for a particular repository and store it in the .sourcecraft/review.yaml file.

Warning

Support for storing configurations for CI/CD, approval rules, and branch policies in a single .src.ci.yaml file at the repository root will soon be discontinued. Use the separate .sourcecraft/ci.yaml, .sourcecraft/review.yaml, and .sourcecraft/branches.yaml files.

For more information about working with rules, see Setting up approval rules in a SourceCraft repository.

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 .sourcecraft/review.yaml file.

See also