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.
On the Home tab, under Your craftspace, navigate to Repositories and select your repository.
In the top-right corner, click Clone.
Depending on your connection method, copy the link for cloning the repository.
In the terminal, run this command:
git clone <link_for_cloning_repository>
Go to your cloned repository:
cd <repository_name>
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
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: