-
Notifications
You must be signed in to change notification settings - Fork 8
Patterns for branch names, commit messages and pull request titles
We follow a few patterns for branch names, commit messages, and GitHub pull request titles. This helps us to keep references to the context provided by Jira tickets.
The patterns are validated by Git hooks and Github actions and are described below.
The branch name must have the Jira ticket id prepended in lowercase, followed by a dash. Example: dsw-123-branch-name
, dsw-1234-branch-name
.
If the branch doesn't have an associated Jira ticket, it must be prepended with dsw-000
. Example: dsw-000-branch-name
.
Commits can be added manually, however, we make use of commitizen
to help us to follow a standard commit message format.
This is done by running yarn cz
instead of git commit ...
. This will prompt a series of questions that will be used to generate the commit message.
The commit message must contain the Jira ticket in uppercase, appended between the type(scope)
and the commit subject. Example: type(scope): DSW-123 your commit message
.
If the branch name already contains a Jira ticket id, it can be inferred from it and automatically added to the commit message. Example: given a branch named dsw-123-my-branch
, when adding a commit with message feat(pie-monorepo): your commit message
, it will be automatically updated to feat(pie-monorepo): DSW-123 your commit message
.
The PR title must contain follow the same pattern as the branch name. Example: type(scope): DSW-123 your PR title
.
A GitHub action will validate the title when the PR is created or after editing it directly. The validation status will be displayed in the PR checks under the item Lint PR Title
item.
Other patterns are also accepted to accommodate for exceptions like Version Packages
and [Snyk]
.