Skip to content

Commit

Permalink
👷 chore: Validate PR titles
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception committed Sep 14, 2023
1 parent fdf07a4 commit 513812d
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 🦄 PR

on: [ pull_request ]

jobs:
commitlint:
name: Validate title
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8.7.5

- name: Fetch commitlint config package version
id: config-package-version
env:
GITMOJI_CONFIG_PACKAGE: "commitlint-config-gitmoji"
run: |
echo "CONFIG_PACKAGE=$(grep -A 2 "$GITMOJI_CONFIG_PACKAGE" pnpm-lock.yaml | awk '/version:/ {print "'"$GITMOJI_CONFIG_PACKAGE"'@" $2}')" >> $GITHUB_OUTPUT
- name: Install commitlint config package
env:
CONFIG_PACKAGE: "${{ steps.config-package-version.outputs.CONFIG_PACKAGE }}"
run: |
pnpm add $CONFIG_PACKAGE
- name: Validate PR title
run: |
echo "${{ github.event.pull_request.title }}" | pnpm -s dlx commitlint
7 changes: 7 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: [ 'gitmoji' ],
rules: {
'subject-case': [2, 'always', 'sentence-case'],
'header-max-length': [2, 'always', 72],
}
}
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"private": true,
"devDependencies": {
"commitlint-config-gitmoji": "^2.3.1"
}
}
99 changes: 99 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 513812d

Please sign in to comment.