Skip to content

Commit

Permalink
feat: add commitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
krsche committed Jul 11, 2022
1 parent e0dd6b4 commit c604299
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
29 changes: 29 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: commitlint

on:
workflow_dispatch:
push:
pull_request:

jobs:
commitlint:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-node@v2

- run: sudo npm install --global @commitlint/{config-conventional,cli}@17

- if: github.event_name == 'pull_request'
name: commitlint (pr)
run: commitlint --from HEAD~${{ github.event.pull_request.commits }}

- if: github.event_name != 'pull_request'
name: commitlint (push)
run: commitlint --from ${{ github.event.push.before }}
# use .before instead of HEAD~1 so that pushes with multiple commits are completely covered as well
# --from is not inclusive, so HEAD~1 will only analyze HEAD
14 changes: 12 additions & 2 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/github"
]
}

0 comments on commit c604299

Please sign in to comment.