Skip to content

Commit 78401c6

Browse files
authored
Fixing ci/prow/check-commit-count. (#28)
Prow is cloning the repo using `git clone --mirror ...`. In addition to that, the changes are directly tested in the `main` branch, therefore, the only way to get the diff is to add the `upstream` remote and check the diff against `upstream/main` instead of `main`. Signed-off-by: Yoni Bettan <[email protected]> Signed-off-by: Yoni Bettan <[email protected]>
1 parent 327d6d8 commit 78401c6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ci/prow/check-commits-count

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
set -euxo pipefail
44

5-
number_of_commits=$(git rev-list --count HEAD ^main)
6-
if [[ ${number_of_commits} != 1 ]]; then
5+
git remote add upstream https://github.com/kubernetes-sigs/kernel-module-management.git
6+
git fetch upstream
7+
8+
commits_count=$(git rev-list --count HEAD ^upstream/main)
9+
# Look like Git (in Prow only) is adding an additional commit for each PR,
10+
# therefore, we are making sure there are 2 commits instead of 1
11+
if [[ ${commits_count} != 2 ]]; then
712
echo '
813
All PRs must contain a single commit.
914
Please refer to https://github.com/kubernetes-sigs/kernel-module-management/blob/main/CONTRIBUTING.md

0 commit comments

Comments
 (0)