Skip to content
BETAGuardrails are in beta. The library, the configuration format and the CLI command can still change.

Guardrails / git

Commits follow Conventional Commits

git/conventional-commits@v1

Every commit message in the build range follows the Conventional Commits specification: the subject line, the blank line before the body, and the BREAKING CHANGE footer.

Idgit/conventional-commits
Versionv1
Categorygit
Default severityerror
Interpreterpython3
Timeout60 seconds
Violations tolerated0
Collectsgit

Collectors

This guardrail gathers nothing itself. It depends on the collectors below, which the CLI runs once per build before any check, and reads what they found out of GUARDRAIL_FACTS. A collector that collects nothing skips this guardrail rather than failing it.

CollectorGathersInputs it is given
gitThe repository, HEAD, the remotes, and every commit between the base ref and HEAD with its message, author, parents and the files the range changed.baseRef

The inputs above are this guardrail's own, passed straight through. Configuring one in buildnote.json changes what is collected, and two guardrails configured the same way share the one collection.

Configuration

json
{
  "guardrails": {
      "failOn": "error",
      "comment": true,
      "checks": [
          {
              "use": "git/conventional-commits@v1",
              "severity": "error",
              "with": {
                  "baseRef": "origin/main",
                  "types": "feat|fix|chore|refactor|test|docs|build|ci|perf|style|revert"
              },
              "exemptions": []
          }
      ]
  }
}

Inputs

InputDescriptionDefaultEnvironment variable
baseRefRef the range starts at. The commits checked are <baseRef>..HEAD.origin/mainGUARDRAIL_INPUT_BASEREF
typesTypes accepted before the colon, as a regular expression alternation.feat|fix|chore|refactor|test|docs|build|ci|perf|style|revertGUARDRAIL_INPUT_TYPES

How to fix

Rewrite each offending commit message as type(scope): description, for example fix(api): reject expired tokens. The scope is optional and must name something when it is given, a ! before the colon marks a breaking change, and the colon is followed by a space and a description. A body starts one blank line after the description, and a breaking change described in the footer is written BREAKING CHANGE: <description> in uppercase. See the Conventional Commits specification.

More in git

All 6 git guardrails

Buildnote Limited
Registered in England and Wales, Reg: 16140412