On the Home tab, navigate to Your craftspace → Repositories.
Select the .sourcecraft repository.
Under Code on the repository page, go to Overview.
Select the branch for editing.
Above the list of files in the branch, click .
Select File.
In the window that opens, enter .sourcecraft/review.yaml as the file name and click Create file.
In the .sourcecraft/review.yaml file, describe the approval rules as follows:
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
The syntax of organization-level settings is identical to that of repository-level settings.
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.
In the top-right corner, click Commit changes.
In the window that opens, configure the procedure for changes:
In the Commit message field, give a comment that will describe the changes you make.
Under Commit branch, select the default main branch.
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>
Create the .sourcecraft/review.yaml file with the approval rule configuration:
nano .sourcecraft/review.yaml
Use the following file structure:
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
The syntax of organization-level settings is identical to that of repository-level settings.
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.
Add the configuration file to the git index, commit, and push the changes to the default main branch: