Skip to content

Commit c09c1e9

Browse files
Add check-commits-count (#88)
Add script to check that each PR consists of one single commit.
1 parent b541128 commit c09c1e9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

ci/prow/check-commits-count

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
set -euxo pipefail
4+
5+
git remote add main https://github.com/rh-ecosystem-edge/kernel-module-management.git
6+
git fetch main
7+
8+
commits_count=$(git rev-list --count HEAD ^main)
9+
# When Prow is testing a PR, it is creating a branch for it but then merges it
10+
# into the "main" branch for testing, therefore, we also get the "merge commit"
11+
# in addition to the original commit.
12+
if [[ ${commits_count} != 2 ]]; then
13+
echo '
14+
All PRs must contain a single commit.
15+
Please refer to https://github.com/rh-ecosystem-edge/kernel-module-management/blob/main/CONTRIBUTING.md
16+
'
17+
exit 1
18+
fi

0 commit comments

Comments
 (0)