Skip to content

Commit 18615f2

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 860ea0c commit 18615f2

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/authors-file.yml

Lines changed: 39 additions & 0 deletions
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 HEAD^1 HEAD^2
24+
)..HEAD^2" >> 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

0 commit comments

Comments
 (0)