Skip to content

Commit bf84884

Browse files
committed
chore(ci): Add fixup commit message check
1 parent 7cf0356 commit bf84884

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/test-lint.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
1922
- name: Set up Python 3.9
2023
uses: actions/setup-python@v1
2124
with:
@@ -40,6 +43,16 @@ jobs:
4043
env:
4144
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
4245

46+
- name: Check commit messages
47+
if: github.event_name == 'pull_request'
48+
run: |
49+
if git log --format=%s "origin/$GITHUB_BASE_REF..origin/$GITHUB_HEAD_REF" | grep '^fixup!' ; then
50+
echo 'Error: this pull request contains fixup commits. Squash them.'
51+
exit 1
52+
fi
53+
# In case `git log` fails
54+
exit "${PIPESTATUS[0]}"
55+
4356
build:
4457
runs-on: ${{ matrix.os }}
4558
strategy:

0 commit comments

Comments
 (0)