diff --git a/.github/workflows/mergify-ready.yml b/.github/workflows/mergify-ready.yml index e2fe06e..b7a5090 100644 --- a/.github/workflows/mergify-ready.yml +++ b/.github/workflows/mergify-ready.yml @@ -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