Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add GitHub workflow to enforce conventional commit PR titles #604

Merged
merged 12 commits into from
Feb 21, 2025
18 changes: 18 additions & 0 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Auto-approve PR
on:
pull_request_target:
types: [ opened, synchronize ]
pull_request:
types: [ opened, synchronize ]

jobs:
auto-approve:
if: github.actor == 'dorthrithil'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Auto-approve
uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.LC_BOT_PAT }}
34 changes: 34 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Enforces that the PR title follows the Conventional Commits specification
# https://www.conventionalcommits.org/en/v1.0.0/
# The PR title is used as the commit message when squashing PRs (requires specific GitHub settings)

name: "Conventional Commits PR Title"

on:
pull_request:
branches:
- next
types:
- synchronize
- opened
- edited
- ready_for_review

jobs:
check_squash_commit:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Extract PR title as squash commit message
run: echo "${{ github.event.pull_request.title }}" > squash_commit_message.txt

- name: Install commitlint
run: npm install @commitlint/{config-conventional,cli}

- name: Validate PR title as squash commit message
run: |
echo "${{ github.event.pull_request.title }}" | npx commitlint --verbose
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
Loading