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 Conventional Commit Lint #821

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/lint-conventional-commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Lint Conventional Commits"
on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request
cancel-in-progress: true # Cancel any previous runs of this workflow

jobs:
main:
name: Lint Conventional Commits
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: amannn/action-semantic-pull-request@v5.4.0
name: "🤖 Check PR title follows conventional commit spec"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Have to specify all types because `maint` and `rel` aren't defaults
types: |
fix
feat
chore
ci
docs
style
refactor
perf
test
Comment on lines +28 to +36
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fix
feat
chore
ci
docs
style
refactor
perf
test
chore
ci
docs
feat
fix
perf
refactor
style
test

Mind if we alphabetize this list?

Also, the list in commitlint.config.js also includes revert and squash. Should those be here too?

- uses: actions/checkout@v4.1.1
- uses: wagoid/commitlint-github-action@v5.4.5
name: "🤖 Check commit messages follow conventional commit spec"
30 changes: 30 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [
2,
'never',
[
'upper-case',
'pascal-case',
]
],
'type-enum': [
2,
'always',
[
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'squash',
'style',
'test'
]
]
}
};