-
Notifications
You must be signed in to change notification settings - Fork 24
feat(beneficiaryid-generation-api): implement commit message linting and automation #33
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 all commits
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,30 @@ | ||
| name: Commit Compliance | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| jobs: | ||
| commitlint: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code with submodule | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
| submodules: true | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 18 | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci --legacy-peer-deps | ||
|
|
||
| - name: Run commitlint on PR | ||
| 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 @@ | ||||||||||
| npx --no -- commitlint --edit $1 | ||||||||||
|
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. Ensure Husky hook loads correctly and has valid shebang Apply this diff: - npx --no -- commitlint --edit $1
+ #!/usr/bin/env sh
+ . "$(dirname "$0")/_/husky.sh"
+ npx --no-install commitlint --edit "$1"📝 Committable suggestion
Suggested change
Author
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. I would like to point out that the shebang (#!/usr/bin/env sh) and the sourcing of the Husky helper script (. "$(dirname "$0")/_/husky.sh") are now deprecated. As of Husky v9.1.1, these lines are automatically removed during installation, and they will fail in Husky v10.0.0. For compatibility with future versions of Husky, it’s recommended to remove these lines from the hook script. The message from husky.sh - 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. @G4URAV001 You're absolutely right. The The suggested change looks good: ✏️ Learnings added
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| module.exports = { | ||
| extends: ['@commitlint/config-conventional'], | ||
| rules: { | ||
| 'body-leading-blank': [1, 'always'], | ||
| 'body-max-line-length': [2, 'always', 100], | ||
| 'footer-leading-blank': [1, 'always'], | ||
| 'footer-max-line-length': [2, 'always', 100], | ||
| 'header-max-length': [2, 'always', 100], | ||
| 'subject-case': [ | ||
| 2, | ||
| 'never', | ||
| ['sentence-case', 'start-case', 'pascal-case', 'upper-case'], | ||
| ], | ||
| 'subject-empty': [2, 'never'], | ||
| 'subject-full-stop': [2, 'never', '.'], | ||
| 'type-case': [2, 'always', 'lower-case'], | ||
| 'type-empty': [2, 'never'], | ||
| 'type-enum': [ | ||
| 2, | ||
| 'always', | ||
| [ | ||
| 'build', | ||
| 'chore', | ||
| 'ci', | ||
| 'docs', | ||
| 'feat', | ||
| 'fix', | ||
| 'perf', | ||
| 'refactor', | ||
| 'revert', | ||
| 'style', | ||
| 'test' | ||
| ], | ||
| ], | ||
| }, | ||
| }; |
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.
Add newline at EOF and remove trailing spaces
YAML requires a newline at end-of-file and no trailing spaces; otherwise, the workflow may fail to parse.
📝 Committable suggestion
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 30-30: no new line character at the end of file
(new-line-at-end-of-file)
[error] 30-30: trailing spaces
(trailing-spaces)