From 41054a95ded8bfef3b3e3b99d4199f78d20ffa14 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Wed, 4 Nov 2026 04:35:08 +0000 Subject: [PATCH] docs: show how to reject GitHub no-reply author emails Add a negative-lookahead author_email_pattern example to CC102 and the policies guide, for projects that need a real, stable author address. Refs commit-check/commit-check#651 --- docs/guides/policies.md | 8 ++++++++ docs/rules.md | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/docs/guides/policies.md b/docs/guides/policies.md index a3df6a8..909649c 100644 --- a/docs/guides/policies.md +++ b/docs/guides/policies.md @@ -76,6 +76,14 @@ To require a company address: author_email_pattern = "^.+@example\\.com$" ``` +To refuse GitHub's no-reply addresses, which cannot receive mail and can lose +their link to the author's account after a username change: + +```toml title="cchk.toml" +[commit] +author_email_pattern = '(?i)^(?!.*@users\.noreply\.github\.com$).+@.+$' +``` + ### Bots Automation cannot meaningfully sign the DCO, and forcing it to produces diff --git a/docs/rules.md b/docs/rules.md index 6572cbe..c3f78ba 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -776,6 +776,16 @@ git config --global user.email you@example.com `^.+@.+$`; set something like `"^.+@example\\.com$"` to require a company domain. +To reject an address instead of requiring one, use a negative lookahead. This +refuses GitHub's no-reply addresses (`jane@users.noreply.github.com` and +`12345+jane@users.noreply.github.com`), which cannot receive mail and can +lose their link to the author's account after a GitHub username change: + +```toml title="cchk.toml" +[commit] +author_email_pattern = '(?i)^(?!.*@users\.noreply\.github\.com$).+@.+$' +``` + !!! note Because the built-in pattern only looks for an `@`, local and placeholder