Skip to content

Commit f70eddc

Browse files
carlescufinashif
authored andcommittedNov 30, 2022
github: workflows: compliance: Ensure no merge commits
Add a simple one-liner that checks for "0" in the count of merge commits. If a merge commit is present the output will be "1" or higher, failing the job. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
1 parent 55ce302 commit f70eddc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎.github/workflows/compliance.yml

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
git config --global user.email "you@example.com"
3838
git config --global user.name "Your Name"
3939
git remote -v
40+
# Ensure there's no merge commits in the PR
41+
[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \
42+
(echo "::error ::Merge commits not allowed, rebase instead";false)
4043
git rebase origin/${BASE_REF}
4144
# debug
4245
git log --pretty=oneline | head -n 10

0 commit comments

Comments
 (0)
Please sign in to comment.