11 name: Test Formalities
12 runs-on: ubuntu-latest
17 - uses: actions/checkout@v3
19 ref: ${{ github.event.pull_request.head.sha }}
22 - name: Determine branch name
24 BRANCH="${GITHUB_BASE_REF#refs/heads/}"
25 echo "Building for $BRANCH"
26 echo "BRANCH=$BRANCH" >> $GITHUB_ENV
28 - name: Test formalities
30 source .github/workflows/scripts/ci_helpers.sh
33 for commit in $(git rev-list HEAD ^origin/$BRANCH); do
34 info "=== Checking commit '$commit'"
35 if git show --format='%P' -s $commit | grep -qF ' '; then
36 err "Pull request should not include merge commits"
40 author="$(git show -s --format=%aN $commit)"
41 if echo $author | grep -q '\S\+\s\+\S\+'; then
42 success "Author name ($author) seems ok"
44 err "Author name ($author) need to be your real name 'firstname lastname'"
48 subject="$(git show -s --format=%s $commit)"
49 if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_\.-]\+: ' -e '^Revert '; then
50 success "Commit subject line seems ok ($subject)"
52 err "Commit subject line MUST start with '<area>: ' ($subject)"
56 body="$(git show -s --format=%b $commit)"
57 sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)"
58 if echo "$body" | grep -qF "$sob"; then
59 success "Signed-off-by match author"
61 err "Signed-off-by is missing or doesn't match author (should be '$sob')"
65 if echo "$body" | grep -v "Signed-off-by:"; then
66 success "A commit message exists"
68 err "Missing commit message. Please describe your changes"