Skip to content

Commit

Permalink
github: workflows: compliance: Ensure no merge commits
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
carlescufi authored and nashif committed Nov 30, 2022
1 parent 55ce302 commit f70eddc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git remote -v
# Ensure there's no merge commits in the PR
[[ "$(git rev-list --merges --count origin/${BASE_REF}..)" == "0" ]] || \
(echo "::error ::Merge commits not allowed, rebase instead";false)
git rebase origin/${BASE_REF}
# debug
git log --pretty=oneline | head -n 10
Expand Down

0 comments on commit f70eddc

Please sign in to comment.