From 5d7ef2852cb8a1ede2ee558a3daa5d434d45e0c8 Mon Sep 17 00:00:00 2001 From: Yoni Bettan Date: Sun, 29 Jan 2023 12:34:34 +0200 Subject: [PATCH] Fixing `check-commits-count` to work on other branches than `main`. (#270) Signed-off-by: Yoni Bettan --- ci/prow/check-commits-count | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/prow/check-commits-count b/ci/prow/check-commits-count index f83793410..14fe09bd0 100755 --- a/ci/prow/check-commits-count +++ b/ci/prow/check-commits-count @@ -5,7 +5,8 @@ set -euxo pipefail git remote add upstream https://github.com/kubernetes-sigs/kernel-module-management.git git fetch upstream -commits_count=$(git rev-list --count HEAD ^upstream/main) +branch_name=$(git branch --show-current) +commits_count=$(git rev-list --count HEAD ^upstream/${branch_name}) # When Prow is testing a PR, it is creating a branch for it but then merges it # into the "main" branch for testing, therefore, we also get the "merge commit" # in addition to the original commit.