-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Enforce conventional commit format in PR title (#398)
Closes #66
- Loading branch information
1 parent
475cda0
commit 7f9d5a8
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Lint PR title | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, edited] | ||
|
||
permissions: | ||
pull-requests: read | ||
|
||
jobs: | ||
lint-pr-title: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
- name: Install commitlint | ||
run: | | ||
npm install @commitlint/config-conventional@19.5.0 | ||
npm install commitlint@19.2.0 | ||
- name: Generate config file | ||
# Here we define our custom rules for commitlint | ||
# Reference of all rules: https://commitlint.js.org/reference/rules.html | ||
run: | | ||
tee -a .commitlintrc.yml << END | ||
extends: ["@commitlint/config-conventional"] | ||
rules: | ||
"subject-case": [2, "always", ["sentence-case"]] | ||
END | ||
- name: Lint PR title | ||
# Use an environment variable to avoid a security vulnerability | ||
# https://stackoverflow.com/a/76679447 | ||
env: | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
run: echo $PR_TITLE | npx commitlint --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters