Enable Branch Rules

Guide to configure branch rules in Outpost Hub repositories.

Outpost Hub allows you to use branch rules and CODEOWNERS to efficiently manage your repositories.

Creating Branch Rules

Branch rules in Outpost Hub can be applied to individual branches or groups of branches within a repository. These rules help define criteria for PR approvals and merges, control branch creation and deletion, and more.

  1. Navigate to the desired repository and go to Settings.
  2. Click the Rules tab.
  3. Select New Branch Rule.
  4. Enter a Name and an optional Description for the rule.
  5. Under Target Patterns, specify which branches the rule applies to using globstar patterns like string, feature-*, or releases/**. You can also set whether the rule applies to the default branch (such as main). Patterns can include or exclude branches as needed.
  6. In the Bypass List, list users who can bypass this rule.
  7. For each of the Available Rules, enable the rule and provide any necessary details. For example, if you select Require a minimum number of reviewers, you need to specify the minimum number of reviewers.
  8. Click Create Rule.

Available Rules

Here are the rules you can configure, along with any additional settings required:

RuleAdditional Configuration
Block branch creationDoes not affect users in the Bypass List.
Block branch deletionDoes not affect users in the Bypass List.
Require pull requestDoes not affect users in the Bypass List.
Require a minimum number of reviewersSpecify the minimum number of reviewers.
Require review from code ownersRequires a CODEOWNERS file in your branches. Without it, this rule cannot be enforced.
Require approval of new changesMust also enable Require a minimum number of reviewers or Require review from code owners. Without these, the rule is ineffective.
Require comment resolutionNone.
Require change request resolutionNone.
Require status checks to passSpecify which status checks must pass.
Limit merge strategiesSelect the permitted merge strategies.
Auto delete branch on mergeNone.

Enabling or Disabling Rules

You can toggle branch rules on or off as needed.

  1. Go to the repository and click on Settings.
  2. Select the Rules tab.
  3. Use the switch next to each rule to enable or disable it.

Modifying or Removing Rules

  1. Open the repository and go to Settings.
  2. Click on the Rules tab.
  3. Locate the rule you want to edit or delete, click More options (⋮), and then select Edit Rule or Delete Rule.

CODEOWNERS

The CODEOWNERS file designates users responsible for specific parts of a repository.

When a CODEOWNERS file is present, Outpost Hub links CODEOWNERS to PRs, though it does not automatically add them as reviewers to avoid unnecessary notifications. You can manually request reviews from CODEOWNERS. If a CODEOWNER reviews a PR independently, they are added as a reviewer for record-keeping. If the Require review from code owners rule is enabled, Outpost ensures CODEOWNERS are among the PR reviewers, blocking merges if none are present.

Place your CODEOWNERS file in the root of your repository, at docs/CODEOWNERS, or under .outpost.

CODEOWNERS Syntax

In the CODEOWNERS file for Outpost Hub, you can assign ownership to users by their email addresses.

You can specify ownership for specific files, directories, or use wildcards. Here are examples of different ways to declare ownership in a CODEOWNERS file:

bash
1Outpost ---
2
3# Global owner
4* @email
5
6# Specific file with multiple owners
7Gemfile.lock @email1 @email2
8
9# Subdirectory owners
10/some_directory/ @email
11/some_directory_2/ @email1 @email2
12
13# Workspace owner
14WORKSPACE @email
15
16# Wildcards
17**/src/** @email
18*.lock @email

© 2024 Outpost Innovations, Inc.