Configure Ruleset

Start configuring the ruleset by getting familiarized with the basic rules that control how users interact with the main branch.

Consider enabling advanced configurations as needed in real-world scenarios.

1. Under your remote repository name,

  • Select Settings tab.
  • Choose Branches.
  • Click Add branch ruleset.

0001

2.

  • For Ruleset Name, enter main-protection.
  • For Enforcement status, select Active.

0002

3. In the Target branches section,

  • Click Add target dropdown.
  • Choose Include default branch. Your default branch should be main branch.

0003

4. Enable Restrict deletions.

0004

5. Enable Require a pull request before merging.

0005

6. Enable Require status checks to pass and Do not require status checks on creation.

0006

7. Add the following check,

  • Click the Add checks dropdown.
  • Filter with Run unit tests value.
  • Select Run unit tests.

0007

8. Repeate step 7, replace Run unit tests with Run integration tests, Scan image, Scan source code, and Build image. You finally get a total of 5 checks required to pass.

0008

9. Enable Block force pushes.

0009

10. Scroll down to the bottom, click Create.

00010