Skip to content

Commit

Permalink
chore: add pr and commit lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyoucao577 committed Sep 30, 2024
1 parent c47e13b commit 01bcc2e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/configs/commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
extends: ['@commitlint/config-conventional'],
};
16 changes: 16 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint Commit Messages

on: [pull_request]

permissions:
contents: read
pull-requests: read

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wagoid/commitlint-github-action@v6
with:
configFile: .github/configs/commitlint.config.mjs
22 changes: 22 additions & 0 deletions .github/workflows/pr_name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: pr-name-linter

on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

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

- name: Install Dependencies
run: |
npm install @commitlint/config-conventional
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
- name: Lint the PR Title
run: |
echo "${PR_TITLE}" | npx --yes commitlint
env:
PR_TITLE: '${{ github.event.pull_request.title }}'

0 comments on commit 01bcc2e

Please sign in to comment.