-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: enforce conventional commit message formatting
1. Add a git commit-msg hook to validate commit messages as they are made 2. Add a GitHub workflow to validate that all commits in a PR conform to conventional commits
- Loading branch information
Showing
7 changed files
with
90 additions
and
2 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,16 @@ | ||
--- | ||
extends: '@commitlint/config-conventional' | ||
|
||
rules: | ||
# See: https://commitlint.js.org/reference/rules.html | ||
# | ||
# Rules are made up by a name and a configuration array. The configuration array contains: | ||
# | ||
# * Severity [0..2]: 0 disable rule, 1 warning if violated, or 2 error if violated | ||
# * Applicability [always|never]: never inverts the rule | ||
# * Value: value to use for this rule | ||
# | ||
# Run `npx commitlint --print-config` to see the current setting for all rules. | ||
# | ||
body-leading-blank: [2, 'always'] | ||
footer-leading-blank: [2, 'always'] |
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,21 @@ | ||
name: Conventional Commits | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
commit-lint: | ||
name: Verify Conventional Commits | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: { fetch-depth: 0 } | ||
|
||
- name: Check Commit Messages | ||
uses: wagoid/commitlint-github-action@v6 | ||
with: { configFile: .commitlintrc.yml } |
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 |
---|---|---|
|
@@ -15,3 +15,6 @@ | |
/rspec-report.xml | ||
/rubocop-report.json | ||
/sig | ||
|
||
node_modules | ||
package-lock.json |
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 @@ | ||
npx --no-install 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
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 |
---|---|---|
@@ -1,8 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
IFS=$'\n\t' | ||
set -vx | ||
|
||
# set -vx | ||
|
||
bundle install | ||
|
||
# Do any other automated setup that you need to do here | ||
if [ -x "$(command -v npm)" ]; then | ||
npm install | ||
else | ||
echo "npm is not installed" | ||
echo "Install npm then re-run this script to enable the conventional commit git hook." | ||
fi |
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,11 @@ | ||
{ | ||
"devDependencies": { | ||
"@commitlint/cli": "^19.5.0", | ||
"@commitlint/config-conventional": "^19.5.0", | ||
"husky": "^9.1.0" | ||
}, | ||
"scripts": { | ||
"postinstall": "husky", | ||
"prepare": "husky" | ||
} | ||
} |