diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 65210ffd..02be8418 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,6 +12,19 @@ on: - '/readme.md' jobs: + commit-emails: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Check commits for noreply addresses + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: sh ./ci/check-commit-emails.sh lint: runs-on: ubuntu-latest strategy: diff --git a/AGENTS.md b/AGENTS.md index fb175392..32b1820d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,6 +14,8 @@ Your code will be reviewed by a time-pressed human. Pull requests that do not fo ## Patch contents +- All listed commit authors and co-authors must be human and their git email addresses must be monitored. Do not use `noreply` email addresses. + - CRITICAL: your patch must _ONLY_ make changes to relevant files and lines. Pull requests that change formatting on unrelated lines or add cruft to the repository will be rejected without review. - CRITICAL: your first pull request _MUST_ be FEWER than 50 lines of code. Once a pull request has been merged, _SUBSEQUENT_ pull requests may be up to 100 lines of code. If it is not possible to fix the issue within these limits, choose a different issue. diff --git a/ci/check-commit-emails.sh b/ci/check-commit-emails.sh new file mode 100755 index 00000000..1b87b388 --- /dev/null +++ b/ci/check-commit-emails.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +authors=$(git log --format='%H%x09%an%x09%ae' "$BASE_SHA..$HEAD_SHA") +coauthors=$(git log --format='%H%x09%(trailers:key=Co-authored-by)' "$BASE_SHA..$HEAD_SHA") +bad_authors=$(printf '%s\n' "$authors" | grep -iE 'noreply' | grep -ivE 'dependabot(\[bot\])?' || true) +bad_coauthors=$(printf '%s\n' "$coauthors" | grep -iE 'noreply' || true) +if [ -n "$bad_authors$bad_coauthors" ]; then + printf '%s\n%s\n' "$bad_authors" "$bad_coauthors" + echo "'noreply' address found in patch. Please provide real contact details or ask a maintainer to adopt your commits." + exit 1 +fi diff --git a/contributing.md b/contributing.md index b4945a77..8c1224a9 100644 --- a/contributing.md +++ b/contributing.md @@ -22,7 +22,7 @@ Tridactyl is very lucky to have a wide base of contributors, 30 at the time of w - You could work on some feature that you really want to see in Tridactyl that we haven't even thought of yet. - Our build process is a bit convoluted, but [excmds.ts][excmds] is probably where you want to start. Most of the business happens there. - We use TypeDoc to produce the `:help` page. Look at the other functions in [excmds.ts][excmds] to get an idea of how to use it; if your function is not supposed to called from the command line, then please add `/** @hidden */` above it to prevent it being shown on the help page. -- Our pre-commit hook runs prettier to format your code. Please don't circumvent it. +- Email addresses mentioned in commits must be monitored. Do not use `noreply` addresses. If you have a good reason why you cannot provide a monitored email address, you can ask a maintainer to adopt your commits under their email address. If you are making a substantial or potentially controversial change, your first port of call should be to stop by and chat to us on [Matrix][matrix] or file an issue to discuss what you would like to change. We really don't want you to waste time on a pull request (GitHub jargon for a contribution) that has no chance of being merged; that said, we are probably happy to gate even the most controversial changes behind an option.