Skip to content

Commit b9b127f

Browse files
committed
GHA: complain if PR adds commits from people not yet listed in ./AUTHORS
not to have to update ./AUTHORS or .mailmap after merging.
1 parent a019c63 commit b9b127f

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/authors-file.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: AUTHORS file
2+
3+
on:
4+
pull_request: { }
5+
6+
jobs:
7+
authors-file:
8+
name: AUTHORS file
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout HEAD
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Check whether ./AUTHORS is up-to-date
18+
run: |
19+
set -exo pipefail
20+
sort -uo AUTHORS AUTHORS
21+
git add AUTHORS
22+
git log --format='format:%aN <%aE>' "$(
23+
git merge-base "origin/$GITHUB_BASE_REF" "origin/$GITHUB_HEAD_REF"
24+
)..origin/$GITHUB_HEAD_REF" >> AUTHORS
25+
sort -uo AUTHORS AUTHORS
26+
git diff AUTHORS >> AUTHORS.diff
27+
28+
- name: Complain if ./AUTHORS isn't up-to-date
29+
run: |
30+
if [ -s AUTHORS.diff ]; then
31+
cat <<'EOF' >&2
32+
There are the following new authors. If the commit author data is correct,
33+
either add them to the AUTHORS file or update .mailmap. See gitmailmap(5) or:
34+
https://git-scm.com/docs/gitmailmap
35+
Don't hesitate to ask us for help if necessary.
36+
EOF
37+
cat AUTHORS.diff
38+
exit 1
39+
fi

CONTRIBUTING.md

+6
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ refs #1234
111111
You can add multiple commits during your journey to finish your patch.
112112
Don't worry, you can squash those changes into a single commit later on.
113113

114+
Ensure your name and email address in the commit metadata are correct.
115+
In your first contribution (PR) also add them to [AUTHORS](./AUTHORS).
116+
If those metadata changed since your last successful contribution,
117+
you should update [AUTHORS](./AUTHORS) and [.mailmap](./.mailmap).
118+
For the latter see [gitmailmap(5)](https://git-scm.com/docs/gitmailmap).
119+
114120
## <a id="contributing-pull-requests"></a> Pull Requests
115121

116122
Once you've commited your changes, please update your local master

0 commit comments

Comments
 (0)