From 7f0ac2d1bb7f823159f48339576f33a4e31eb954 Mon Sep 17 00:00:00 2001 From: Nils Weiss Date: Wed, 2 Sep 2026 18:58:52 +0200 Subject: [PATCH] Restrict AI-Assisted commit check to PR commits on merge checkouts. actions/checkout builds a merge of the PR into the base branch, so rev-list from HEAD was also validating base-branch tips. Use HEAD^1..HEAD^2 when that merge topology is present. AI-Assisted: yes (Cursor Agent) Co-authored-by: Cursor --- .config/ci/check_commits.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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