From 4585c357b1da8ef71a1f6029f3ccdab719377925 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Strub Date: Fri, 8 May 2026 08:58:56 +0200 Subject: [PATCH] ci: enforce single-commit PRs --- .github/workflows/enforce-single-commit.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/enforce-single-commit.yml diff --git a/.github/workflows/enforce-single-commit.yml b/.github/workflows/enforce-single-commit.yml new file mode 100644 index 000000000..1cec8fb5c --- /dev/null +++ b/.github/workflows/enforce-single-commit.yml @@ -0,0 +1,21 @@ +name: Enforce single-commit PR + +on: + pull_request: + types: [opened, synchronize, reopened] + merge_group: + +jobs: + check-commit-count: + runs-on: ubuntu-latest + steps: + - name: Verify PR has exactly one commit + env: + COMMITS: ${{ github.event.pull_request.commits }} + run: | + echo "PR contains $COMMITS commit(s)." + if [ "$COMMITS" -ne 1 ]; then + echo "::error::This PR has $COMMITS commits. Please squash to a single commit." + exit 1 + fi + echo "OK: PR has exactly 1 commit."