Skip to content

Commit cc504a6

Browse files
committed
Updating ci/prow/check-commit-count to use the gh cli.
Prow is cloning the repo using `git clone --mirror ...`. In addition to that, the changes are directly tested in the `main` branch, therefore, the current implementation isn't working. Transitioning to the `gh` cli instead. Signed-off-by: Yoni Bettan <[email protected]>
1 parent 78401c6 commit cc504a6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

ci/prow/check-commits-count

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22

33
set -euxo pipefail
44

5-
git remote add upstream https://github.com/kubernetes-sigs/kernel-module-management.git
6-
git fetch upstream
5+
commits_count=$(gh pr view ${PULL_NUMBER} -R ${REPO_OWNER}/${REPO_NAME} --json commits --jq '.commits | length')
76

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
7+
if [[ ${commits_count} != 1 ]]; then
128
echo '
139
All PRs must contain a single commit.
1410
Please refer to https://github.com/kubernetes-sigs/kernel-module-management/blob/main/CONTRIBUTING.md

0 commit comments

Comments
 (0)