-
Notifications
You must be signed in to change notification settings - Fork 43
Commit message linting #90
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
base: develop
Are you sure you want to change the base?
Changes from 2 commits
c2f23f6
69c8262
ded8b1b
24c05a9
f7fd0b6
68cae46
161e5fa
b53fae1
4fbd098
470a690
8677abe
4975568
18c3066
030f142
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,28 @@ | ||
| name: Commit Message Lint | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, edited] | ||
|
|
||
| jobs: | ||
| lint-commits: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout PR branch | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '22' | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| - name: Install dependencies | ||
| run: npm install | ||
|
|
||
| - name: Lint commit messages | ||
| run: | | ||
| git fetch origin main | ||
| COMMITS=$(git log origin/main..HEAD --pretty=format:"%H") | ||
| echo "$COMMITS" | while read commit; do | ||
| npx commitlint --from=$commit --to=$commit --verbose | ||
| done | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| npx --no-install commitlint --edit $1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| npm test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| npx --no-install cz | ||
|
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. 💡 Verification agent 🧩 Analysis chainVerify the Commitizen usage in prepare-commit-msg hook The current implementation runs Commitizen without passing the commit message file as a parameter, which may not work as expected. Typically, a prepare-commit-msg hook receives parameters ($1, $2, $3) that should be passed to the tool that modifies the commit message. 🏁 Script executed: #!/bin/bash
# Check Commitizen documentation for proper usage in Git hooks
echo "Checking standard prepare-commit-msg hooks for Commitizen..."
curl -s https://github.com/commitizen/cz-cli/blob/master/README.md | grep -A 10 "prepare-commit-msg"
echo -e "\nStandard prepare-commit-msg hooks typically pass parameters:"
echo "Example: npx --no-install cz --hook || true"
echo "or: exec < /dev/tty && npx cz --hook || true"
echo -e "\nCurrent implementation:"
cat .husky/prepare-commit-msgLength of output: 65842 Ensure the Husky hook invokes Commitizen with the The current npx --no-install czbut Commitizen’s hook mode requires the File: .husky/prepare-commit-msg
-------------------------------------------------------------------
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
-
-npx --no-install cz
+exec < /dev/tty && npx --no-install cz --hook || true
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = { | ||
| extends: ['@commitlint/config-conventional'], | ||
|
Member
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. |
||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.