Skip to content

Commit a235b0d

Browse files
committed
ci: reject bad commit messages
1 parent d065ba2 commit a235b0d

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/build.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ jobs:
159159
run: |
160160
cd python/railjson_generator
161161
poetry run pytype -j auto
162-
162+
163163
- name: Pytest
164164
run: |
165165
cd python/railjson_generator
@@ -176,6 +176,30 @@ jobs:
176176
verbose: true
177177
files: coverage.xml
178178

179+
check_commits:
180+
runs-on: ubuntu-latest
181+
steps:
182+
- name: Checkout code
183+
uses: actions/checkout@v2
184+
with:
185+
fetch-depth: 0 # Fetch all history for all branches and tags
186+
187+
- name: Check for 'fixup' commits
188+
run: |
189+
# We don't have a base ref to check against if we aren't in a
190+
# pull_request workflow.
191+
BASE=${{ github.base_ref }}
192+
if [[ -z "$BASE" ]]; then
193+
exit 0
194+
fi
195+
196+
# Check that commit don't start with fixup
197+
if git log --format=%s origin/"$BASE"..HEAD | grep -i '^fixup'; then
198+
echo "Found a bad commit message"
199+
exit 1
200+
fi
201+
202+
179203
check_integration_tests:
180204
runs-on: ubuntu-latest
181205
steps:

0 commit comments

Comments
 (0)