Generate an approval rule configuration file named .sourcecraft/review.yaml, e.g.:
codereview:need_ships:1# Required number of approvals from reviewersignore_self_ship:false# Ignore approvals from the pull request authorignore_non_reviewers_block:false# Ignore pull request blocking from non-reviewersauto_assign:true# Automatically assign reviewersrules:-patterns:-"**"# Repository path patternreviewers:usernames:-"<user_name>"# List of reviewersassign:1# Number of automatically assigned reviewersneed_ships:1# Required number of approvals from reviewersignore_self_ship:false# Ignore approvals from the pull request author
Tip
For group filtering, we recommend to use the ** pattern because the simple * pattern will not give you a match in expressions with /.
Under patterns, specify the repository paths for your approval rules as follows:
"**": Apply the rule to the entire repository.
"src/**": Apply the rule only to the src directory.
"!docs/**": Do not apply the rule to the docs directory.
You can list multiple patterns one by one, like this:
-patterns:-"**"-"!docs/**"
This way, the rule will apply to any changes in your repository except those in the docs directory.
Tip
When using multiple patterns, list the "**" pattern first.
Under usernames, list the users the pull request must feature at least one approval from.
Add the approval rule configuration file to the git index, commit, and push the changes to the main branch: