From 02817325c5089790b751c8ea9fa8b7d7b6e65e93 Mon Sep 17 00:00:00 2001 From: Josnoww Date: Tue, 18 Jun 2024 09:52:35 +0200 Subject: [PATCH] Add check to prevent fixup commits from being merged --- .github/workflows/check_fixup_commits.yml | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/check_fixup_commits.yml diff --git a/.github/workflows/check_fixup_commits.yml b/.github/workflows/check_fixup_commits.yml new file mode 100644 index 0000000..da7764b --- /dev/null +++ b/.github/workflows/check_fixup_commits.yml @@ -0,0 +1,24 @@ +name: 'Check Fixup Commits' +description: 'Checks for commits containing "Fixup!"' +inputs: + token: + description: 'GitHub Token' + required: true +runs: + using: 'composite' + steps: + - name: Set up Git + run: | + git fetch origin +refs/heads/*:refs/remotes/origin/* + git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" + git fetch --all + + - name: Check for Fixup Commits in Pull Request + run: | + commits=$(git log origin/${{ github.event.pull_request.base.sha }}..origin/${{ github.event.pull_request.head.sha }} --oneline) + if echo "$commits" | grep -i "fixup!"; then + echo "::warning file=,line=,col=::There are commits containing 'Fixup!'" + exit 1 + fi + shell: bash +