diff --git a/.config/committed.toml b/.config/committed.toml new file mode 100644 index 0000000..25fc349 --- /dev/null +++ b/.config/committed.toml @@ -0,0 +1,3 @@ +style = "conventional" +ignore_author_re = '\[bot\]' +subject_capitalized = false diff --git a/.config/mise.toml b/.config/mise.toml index a1883bb..be23566 100644 --- a/.config/mise.toml +++ b/.config/mise.toml @@ -1,4 +1,5 @@ [tools] +committed = "1.1.5" dprint = "0.47.6" lefthook = "latest" shellcheck = "0.10.0" diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 0fe7e30..6833a41 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -11,8 +11,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 # for commit message checks - uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8 - - name: Run checks + - name: Check commit messages + run: lefthook run commit-msgs-on-pr-branch --no-tty + if: ${{ github.event_name == 'pull_request' }} + - name: Check code env: FORCE_COLOR: true LEFTHOOK_QUIET: meta,execution diff --git a/.lefthook.yaml b/.lefthook.yaml index dd9af77..9ac268f 100644 --- a/.lefthook.yaml +++ b/.lefthook.yaml @@ -25,3 +25,13 @@ pre-commit: rc=$? test $rc -eq 0 || echo "error: found files modified by hooks" >&2 exit $rc + +commit-msg: + commands: + committed: + run: mise exec -- committed --config .config/committed.toml --fixup --wip --commit-file "{1}" + +commit-msgs-on-pr-branch: + commands: + committed: + run: mise exec -- committed --config .config/committed.toml -vv --no-merge-commit HEAD~..HEAD^2