Skip to content

Commit

Permalink
ci: added no-fixup-commits check
Browse files Browse the repository at this point in the history
  • Loading branch information
frazarshad committed Aug 13, 2024
1 parent 5681f31 commit dc4b38c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/mergify-ready.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,32 @@ jobs:
echo -e "$fixup_commits"
exit 1
fi
no-fixup-commits:
runs-on: ubuntu-latest
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.draft == false &&
github.event.pull_request.base.ref == 'main' &&
contains(github.event.pull_request.labels.*.name, 'automerge:rebase') &&
!contains(github.event.pull_request.labels.*.name, 'bypass:linear-history')
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check for fixup commits
id: fixup-commits
run: |
if [[ $(git rev-list "$BASE_SHA".."$HEAD_SHA" --grep="^\(fixup\|amend\|squash\)! " | wc -l) -eq 0 ]]; then
echo "No fixup/amend/squash commits found in commit history"
else
echo "fixup/amend/squash commits found in commit history"
exit 1
fi

0 comments on commit dc4b38c

Please sign in to comment.