ci: automate PR title linting (#229)

* ci: automate PR title linting

This will help with Squash & Merge when you need the squashed commit to have the correct Conventional Commits format so that it can be parsed when generating release notes

(With Squash & Merge the squashed commit message is taken from the PR title)

* chore: minor updates

---------

Co-authored-by: Johann Schopplich <mail@johannschopplich.com>
This commit is contained in:
Okinea Dev
2025-12-01 20:56:56 +01:00
committed by GitHub
parent d662c21262
commit 7ed9701028
4 changed files with 100 additions and 0 deletions

36
.github/workflows/pr-title.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Check PR Title
on:
pull_request:
types: [opened, edited]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint-pr-title:
name: Lint PR title
runs-on: ubuntu-latest
if: ${{ (github.event.action == 'opened' || github.event.changes.title != null) && github.actor != 'renovate[bot]' }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
# Only fetch the config file from the repository
sparse-checkout-cone-mode: false
sparse-checkout: commitlint.config.ts
- name: Install dependencies
run: npm install -D @commitlint/cli @commitlint/config-conventional
- name: Validate PR title with commitlint
run: echo "$PR_TITLE" | npx commitlint
env:
PR_TITLE: ${{ github.event.pull_request.title }}