Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from fingerprintjs/add-commit-message-hooks
Add hooks for commit messages
- Loading branch information
Showing
4 changed files
with
49 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,3 @@ | ||
#!/bin/sh | ||
|
||
npx commitlint --edit $1 |
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,38 @@ | ||
name: Lint Commit Messages | ||
on: [pull_request] | ||
|
||
permissions: | ||
pull-requests: write | ||
jobs: | ||
commitlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: wagoid/commitlint-github-action@456526eec71276a59e74aafdfe06a9632ac2eee1 | ||
id: commitlint | ||
- if: ${{ failure() && steps.commitlint.outcome == 'failure' }} | ||
uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd | ||
with: | ||
header: Commitlint | ||
recreate: true | ||
message: | | ||
## Wrong commit message format detected | ||
We use [Semantic Commit Messages](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716) in our project. | ||
> **Warning** | ||
> Probably you forgot to activate local git hooks. | ||
Run the next command in the project root to activate local hooks: | ||
```sh | ||
sh ./scripts/install_hooks.sh | ||
``` | ||
More info you can find in [job logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | ||
- if: ${{ success() }} | ||
uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd | ||
with: | ||
header: Commitlint | ||
hide: true | ||
hide_classify: "OUTDATED" |
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 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; |
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,7 @@ | ||
#!/bin/sh | ||
|
||
# Make .git_hooks folder as hooks source for git | ||
git config core.hooksPath .git_hooks/ | ||
|
||
# install commitlint and @commitlint/config-conventional globally | ||
npm install -g commitlint @commitlint/config-conventional |