Skip to content

Commit

Permalink
Add commit message checker job
Browse files Browse the repository at this point in the history
This commit is deliberately bad, to fail CI!
  • Loading branch information
EzraBrooks committed Sep 5, 2024
1 parent 2c257f1 commit 0e96475
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/check-commit-messages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Commit message standards checks

on:
pull_request:

jobs:
check_issue_references:
runs-on: ubuntu-24.04
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
lfs: true
submodules: recursive
# Don't do a shallow clone since we need to poke around in the Git history
fetch-depth: 0

- name: Check that every commit name includes an issue reference like "#1"
run: |
IFS=$'\n'
for f in $(git log --oneline ${{github.base_ref}}..${{github.ref}})
do
if [[ $f =~ ^.*#[0-9]+.*$ ]];
then
continue
else
echo "Found commit with no issue number: $f"
exit 1
fi
done

0 comments on commit 0e96475

Please sign in to comment.