Skip to content

Commit

Permalink
ci: add conventional commit message check
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-reineke committed Oct 24, 2023
1 parent 2546441 commit 046e2cf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lua_language_server.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Lua Language Server check
name: Lua Language Server Check

on:
workflow_call:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Nightly Neovim check
name: Nightly Neovim Check
# Checks LSP and unit tests against new Neovim nightly once a week

on:
Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/pr_check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull request check
name: Pull Request Check

on:
pull_request:
Expand Down Expand Up @@ -54,3 +54,28 @@ jobs:
- uses: actions/checkout@v2
- name: Block Fixup Commit Merge
uses: 13rac1/[email protected]

conventional-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check Commit Messages
run: |
commits=$(git log --no-merges --pretty=format:"%s" HEAD~${{ github.event.pull_request.commits }}..HEAD)
bad_commits=()
for commit in "$commits"; do
if ! echo $commit | grep -qE "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.+\))?: .+"; then
bad_commits+=("$commit")
fi
done
if [[ ${#bad_commits[@]} -ne 0 ]]; then
echo "The following commits do not follow the Conventional Commit format:"
for bad_commit in "${bad_commits[@]}"; do
echo " - $bad_commit"
done
exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run tests
name: Unit Tests

on:
workflow_call:
Expand Down

0 comments on commit 046e2cf

Please sign in to comment.