Git Integrity Policy
Template Policy
This template policy blocks the merge action if the pull request does not adhere to the specified requirements such as conventional commit messages, branch names and titles. Additionally, it enforces good practices such as promoting a linear commit history and requiring useful descriptions in pull requests.workflows:
- name: Git Integrity Policy
run:
- forEach:
value: $commitMessage
in: $commits()
do:
- if: $matchString("(fix|feat|docs):.+", $commitMessage) == false
then: $failCheckStatus($sprintf("Commit message %s does not comply with convention.", [$commitMessage]))
- if: $matchString("(fix|feat|docs)/.+", $head()) == false
then: $failCheckStatus($sprintf("Branch %s must start either with fix/, feat/ or docs/", [$head()]))
- if: $matchString("(fix|feat|docs):.+", $title()) == false
then: $failCheckStatus($sprintf("Title %s must start either with fix, feat or docs", [$title()]))
- if: $hasLinearHistory() == false
then: $failCheckStatus("Pull Request does not have a linear commit history")
- if: $description() == ""
then: $failCheckStatus("Description is empty")