-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check-shortlog: check all contributors are listed correctly
- Loading branch information
1 parent
4f1fdeb
commit d773c8d
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Check Shortlog | ||
description: | | ||
Check the output of git shortlog -s matches the list of contributors in the | ||
CONTRIBUTING.md file. | ||
inputs: | ||
contributing_file: | ||
description: Path to contributing file. | ||
default: CONTRIBUTING.md | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Get known contributors from contributing file | ||
shell: bash | ||
run: | | ||
echo '::group::Get known contributors from contributing file' | ||
sed \ | ||
-n \ | ||
-e 's/ - //' \ | ||
-e 's/^(//' -e 's/)$//' \ | ||
-e '/start-shortlog/,${p;/end-shortlog/q}' \ | ||
"${{ inputs.contributing_file }}" \ | ||
| head -n -1 \ | ||
| tail -n +2 \ | ||
| sort \ | ||
> contributors | ||
cat contributors | ||
echo "::endgroup::" | ||
- name: List commit authors | ||
shell: bash | ||
run: | | ||
echo '::group::List commit authors' | ||
git shortlog -s "${{ github.sha }}" \ | ||
| awk '{$1=""; print substr($0,2) }' \ | ||
| sort \ | ||
| grep -v 'github-actions\[bot\]' \ | ||
> shortlog | ||
cat shortlog | ||
echo "::endgroup::" | ||
- name: See if they differ | ||
shell: bash | ||
run: | | ||
echo '::group::See if they differ' | ||
diff shortlog contributors \ | ||
|| (echo '::endgroup::' \ | ||
&& echo '::error::${{ inputs.contributing_file }} or .mailmap needs updating.' \ | ||
&& echo '::warning::If you have not added yourself to this file please do so.' \ | ||
&& echo '::warning::If you need to register a second email address add an entry to the .mailmap file (https://git-scm.com/docs/gitmailmap).' \ | ||
&& echo '::warning::If you want to change the appearence of your name add/edit the entry in the .mailmap file.' \ | ||
&& false) |