Skip to content

Commit

Permalink
ci: add commit linter
Browse files Browse the repository at this point in the history
  • Loading branch information
majori committed Sep 5, 2024
1 parent 06e5f95 commit a3fbb6e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
extends: ["@commitlint/config-conventional"],
};
29 changes: 28 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Lint

on:
push:
pull_request:
workflow_call:

Expand All @@ -13,9 +14,35 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
cache: false # Disable cache since golangci-lint does its own caching

- name: Lint source code
uses: golangci/golangci-lint-action@v4
with:
version: latest

commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install commitlint
run: |
npm install conventional-changelog-conventionalcommits
npm install commitlint@latest
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --last --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: >-
npx commitlint
--from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }}
--to ${{ github.event.pull_request.head.sha }}
--verbose

0 comments on commit a3fbb6e

Please sign in to comment.