Skip to content

git_commit_author_allowlist

Assert every commit author in scope matches an allowed email and/or name pattern. At least one of email_pattern: / name_pattern: is required; specifying both means BOTH must match (AND). A commit whose author fails any specified pattern fires one violation. Demand: enterprise repos enforcing contributor identity against a corporate domain; OSS projects catching commits from sock-puppet or compromised accounts.

email_pattern: matches git log %ae; name_pattern: matches git log %an. Both are Rust regexes. Shares the commit-validation family’s since: / include_merges: semantics and failure modes (silent outside a git repo; a bad since: ref hard-fails with a shallow-clone hint).

OptionTypeRequiredDefaultDescription
email_patternstringnullRust-regex the author email (git log %ae) must match, e.g. ^.+@example\.com$.
include_mergesbooleanfalseWhen validating a range (since: set), include merge commits. Has no effect when since: is unset; combining include_merges: true with no since: is a load-time error.
name_patternstringnullRust-regex the author name (git log %an) must match.
sincestringnullGit ref to use as the base of the commit range. When set, validates every commit in <since>..HEAD instead of just HEAD. Accepts anything git rev-parse does. Use the canonical {{env.X}} interpolation to pass a SHA via an env var, e.g. since: "{{env.ALINT_BASE_SHA | default('origin/main')}}".

Plus the common level, id, and when fields. This rule analyses the whole repository, so it takes no paths. This table is generated from the JSON Schema; option types and defaults are authoritative.

A commit authored from outside the allowed email domain

Section titled “A commit authored from outside the allowed email domain”

The rule fires on this repository:

README.md
README.md
# demo

With this .alint.yml:

version: 1
rules:
- id: org-authors
kind: git_commit_author_allowlist
email_pattern: '^.+@example\.com$'
level: error

committed with this history (oldest first):

2024-01-15T09:00:00+00:00 feat: a change from an outside author

alint check reports:

Terminal window
--- Repository-level -----------------------------------------------------------
x error org-authors
commit e3a1641: author "alint scenario <scenario@alint.test>" is
not in the allowlist (subject: "feat: a change from an outside
author")
Summary (1 violation):
x 1 error
0 passing * 1 failing

This repository is compliant:

README.md
README.md
# demo

With this .alint.yml:

version: 1
rules:
- id: org-authors
kind: git_commit_author_allowlist
email_pattern: '^.+@alint\.test$'
level: error

committed with this history (oldest first):

feat: a change from an allowed author

alint check reports:

Terminal window
v All 1 rule(s) passed.