Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/block-fixup-commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Block "fixup" commit merges

on:
pull_request:
branches:
- main

jobs:
check-commits:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: ${{ github.event.pull_request.commits }} + 1

- name: Fetch the base branch
run: git fetch origin ${{ github.event.pull_request.base.ref }}

- name: Look for the fixup prefix
id: search-for-fixup-prefix
run: |
commit_messages=$(git log origin/${{ github.event.pull_request.base.ref }}..$GITHUB_HEAD_REF --format=%B)

if echo "$commit_messages" | grep -q "^fixup"; then
echo "Please make sure to squash all commits that have the 'fixup' prefix in your commit messages."
exit 1
fi