Working with approval rule templates - Amazon CodeCommit
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Working with approval rule templates

You can create approval rules for pull requests. To automatically apply approval rules to some or all of the pull requests created in repositories, use approval rule templates. Approval rule templates help you customize your development workflows across repositories so that different branches have appropriate levels of approvals and control. You can define different rules for production and development branches. Those rules are applied every time a pull request that matches the rule conditions is created. For more information about managed policies and permissions for approval rule templates, see Permissions for actions on approval rule templates and Amazon managed policies for CodeCommit.

You can associate an approval rule template with one or more repositories in the Amazon Web Services Region where they are created. When a template is associated with a repository, it automatically creates approval rules for pull requests in that repository as part of creating the pull request. Just like a single approval rule, an approval rule template defines an approval rule structure, including the number of required approvals and an optional pool of users from which approvals must come. Unlike an approval rule, you can also define destination references (the branch or branches), also known as branch filters. If you define destination references, then only pull requests whose destination branch names match the specified branch names (destination references) in the template have rules created for them. So, for example, if you specify refs/heads/main as a destination reference, the approval rule defined in the template is only applied to pull requests if the destination branch is main.

An approval rule template that requires 1 approver from a defined approval rule if a pull request is created on a branch named main, associated with two repositories