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 subject="$(git show -s --format=%s $commit)"
41 if echo "$subject" | grep -q -e '^[0-9A-Za-z,+/_\.-]\+: ' -e '^Revert '; then
42 success "Commit subject line seems ok ($subject)"
44 err "Commit subject line MUST start with '<area>: ' ($subject)"
48 body="$(git show -s --format=%b $commit)"
49 sob="$(git show -s --format='Signed-off-by: %aN <%aE>' $commit)"
50 if echo "$body" | grep -qF "$sob"; then
51 success "Signed-off-by match author"
53 err "Signed-off-by is missing or doesn't match author (should be '$sob')"
57 if echo "$body" | grep -v "Signed-off-by:"; then
58 success "A commit message exists"
60 err "Missing commit message. Please describe your changes"