Skip to content

Commit

Permalink
check-shortlog: check all contributors are listed correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed May 11, 2021
1 parent 4f1fdeb commit d773c8d
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions check-shortlog/action.yml
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)

0 comments on commit d773c8d

Please sign in to comment.