-
Notifications
You must be signed in to change notification settings - Fork 17
ci: add GitHub Actions for commitlint and DCO checks #25
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
Changes from 1 commit
d333c6b
3b6d830
db4c4d3
1e05af7
d4062e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Commitlint | ||
|
||
on: | ||
pull_request: | ||
branches: [ master, main ] | ||
|
||
jobs: | ||
commitlint: | ||
runs-on: ubuntu-latest | ||
name: Check commit messages | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm install --save-dev @commitlint/config-conventional @commitlint/cli | ||
|
||
- name: Validate current commit (last commit) with commitlint | ||
if: github.event_name == 'push' | ||
|
||
run: npx commitlint --from HEAD~1 --to HEAD --verbose | ||
|
||
- name: Validate PR commits with commitlint | ||
if: github.event_name == 'pull_request' | ||
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: DCO Check | ||
|
||
on: | ||
pull_request: | ||
branches: [ master, main ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a types: filter to the pull_request trigger to avoid unnecessary runs |
||
|
||
jobs: | ||
dco-check: | ||
runs-on: ubuntu-latest | ||
name: Developer Certificate of Origin Check | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: DCO Check | ||
uses: dcoapp/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
rules: { | ||
'type-enum': [ | ||
2, | ||
'always', | ||
[ | ||
'build', | ||
'chore', | ||
'ci', | ||
'docs', | ||
'feat', | ||
'fix', | ||
'perf', | ||
'refactor', | ||
'revert', | ||
'style', | ||
'test' | ||
] | ||
], | ||
'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']], | ||
'subject-empty': [2, 'never'], | ||
'subject-full-stop': [2, 'never', '.'], | ||
'header-max-length': [2, 'always', 72] | ||
} | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add comments for team clarity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Install dependencies should use --no-save instead of --save-dev