diff --git a/.config/ci/check_commits.sh b/.config/ci/check_commits.sh index f5efc667c48..8ca9bc16bc8 100755 --- a/.config/ci/check_commits.sh +++ b/.config/ci/check_commits.sh @@ -6,7 +6,14 @@ # We copy Wireshark's contributing guide, thanks to them for the idea ! # This script is inspired by https://gitlab.com/wireshark/wireshark/-/blob/master/.gitlab-ci.yml -commits=$(git rev-list --no-merges --after="2026-01-00T00:00:00" --max-count=$((PR_FETCH_DEPTH - 1)) HEAD) +# On pull_request, actions/checkout creates a merge of the PR into the base +# branch (HEAD^1=base tip, HEAD^2=PR tip). Restrict the check to PR commits +# so base-branch history is not false-failed for missing trailers. +if git rev-parse -q --verify HEAD^2 >/dev/null 2>&1; then + commits=$(git rev-list --no-merges HEAD^1..HEAD^2) +else + commits=$(git rev-list --no-merges --after="2026-01-00T00:00:00" --max-count=$((PR_FETCH_DEPTH - 1)) HEAD) +fi if [ -z "$commits" ]; then echo "No commit to check in PR. OK." exit 0