diff --git a/.github/workflows/check_fixups.yml b/.github/workflows/check_fixups.yml new file mode 100644 index 0000000000..12cc40f438 --- /dev/null +++ b/.github/workflows/check_fixups.yml @@ -0,0 +1,30 @@ +name: Git Fixup Commit Check + +on: + pull_request: + branches: [ master ] + types: [ opened, synchronize, reopened ] + +jobs: + check_fixups: + name: Check for fixup commits + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Verify commit messages + run: | + echo "Checking commit messages for fixup commits... " + FIXUPS=$(git log ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --oneline | grep -E "^[a-f0-9]+ fixup!" || true) + if [ -n "$FIXUPS" ]; then + echo "ERROR: Found 'fixup!' commits in this pull request. Please squash them before merging!" + echo "Found items:" + echo "$FIXUPS" + exit 1 + fi + + echo "No fixup! commits found!" \ No newline at end of file