Skip to content

Manage git Branches With gitStream

Use gitStream to enforce branch naming conventions, review assignment, and other branch managment workflows.

Enforce Branch Naming Conventions - Automatically enforce prefixes or keywords in PR branch names.

Assign Reviewers Based on Target Branch - Automatically assign PR reviewers for target branches that include a specified keyword.

Enforce Branch Naming Conventions

Automatically enforce prefixes or keywords in PR branch names.

Enforce Branch Naming Conventions

Configuration Description

Conditions (all must be true):

  • The incoming branch name is missing a required prefix feature fix or stable
  • The invoming branch name fails to match a specified regex pattern. In this case abc- followed by a number.
  • The incoming branch name is not listed in an ignoreList custom expression.

Automation Actions:

  • Post a comment explaining the branch name requirements.
  • Apply a red label: ❗ Incorrect Branch Name
  • Close the PR.

Enforce Branch Naming Conventions

# -*- mode: yaml -*-
  version: 1.0
      - {{ not has.requiredBranchPrefix }}
      - {{ not has.requiredBranchKeyword }}
      - {{ not ignoreList }}
      - action: add-label@v1
          label: "❗ Incorrect Branch Name"
          color: {{ }}
      - action: add-comment@v1
          comment: |
            All PR branch names must be prefixed by feature, stable, or fix, and must contain a reference to a Jira ticket. E.g. 'feature-abc-1234'
            Please move your changes to a new branch that meets these requirements and open a new PR.
      - action: close@v1

  requiredBranchPrefix: {{ | includes(regex=r/^(feature|stable|fix)/) }}
  requiredBranchKeyword: {{ | includes(regex=r/abc+-\d+/) }}

ignoreList: {{ | match(regex=r/^(development|staging)/) }}

Additional Resources

gitStream is a workflow automation tool that enables you to use YAML configuration files to optimize your code review process. Add context to PRs, find code experts for reviews, and automate the merge process to maximize developer productivity.

Learn More about how gitStream Works.

Related Automations:

More Automations can be found on the Automation Library and Integrations pages.