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