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.
Configuration Description
Conditions (all must be true):
- The incoming branch name is missing a required prefix
feature
fix
orstable
- 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 -*-
manifest:
version: 1.0
automations:
enforce_branch_name:
if:
- {{ not has.requiredBranchPrefix }}
- {{ not has.requiredBranchKeyword }}
- {{ not ignoreList }}
run:
- action: add-label@v1
args:
label: "❗ Incorrect Branch Name"
color: {{ colors.red }}
- action: add-comment@v1
args:
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
has:
requiredBranchPrefix: {{ branch.name | includes(regex=r/^(feature|stable|fix)/) }}
requiredBranchKeyword: {{ branch.name | includes(regex=r/abc+-\d+/) }}
ignoreList: {{ branch.name | 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:
- Assign additional reviewers for large PRs
- Assign or suggest reviewers based on level of code expertise for the code changed in a PR.
- Assign reviewers based on modified directories and files
- Assign reviewers to share knowledge based on pre-determined criteria
More Automations can be found on the Automation Library and Integrations pages.