-
Notifications
You must be signed in to change notification settings - Fork 24
feat(git-hooks): add commit message validation and pre-commit checks #62
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
Open
DurgaPrasad-54
wants to merge
28
commits into
PSMRI:main
Choose a base branch
from
DurgaPrasad-54:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
ed08062
docs(readme): add documentation badge
DurgaPrasad-54 01c25bd
chore(swagger): automate swagger sync to amrit-docs
DurgaPrasad-54 6c4bb16
chore(swagger): update swagger workflow
DurgaPrasad-54 e4a5bce
fix(swagger): fix github workflow running issue
DurgaPrasad-54 081d216
chore(swagger): add env-driven Dev/UAT/Demo servers, update and uncomβ¦
DurgaPrasad-54 a2a77be
Merge branch 'main' into main
DurgaPrasad-54 edb483e
chore(swagger): deduplicate SwaggerConfig and extract constants
DurgaPrasad-54 293023f
Merge branch 'main' of https://github.com/DurgaPrasad-54/BeneficiaryIβ¦
DurgaPrasad-54 88cf231
chore(swagger): fix the jwt token issue in properties
DurgaPrasad-54 01041c5
feat(git-hooks): add commit message validation using commit-msg hook
DurgaPrasad-54 02c926b
feat(git-hooks): add git-hook for check pre commit
DurgaPrasad-54 0dd047d
Merge branch 'main' of https://github.com/DurgaPrasad-54/BeneficiaryIβ¦
DurgaPrasad-54 ad32038
Merge branch 'PSMRI:main' into main
DurgaPrasad-54 01a6e7c
chore(workflow): enforce scoped commit message format
DurgaPrasad-54 3ac2102
feat(git-hooks): add commit message validation using commit-msg hook
DurgaPrasad-54 c1e8801
chore(commit): update workflow and hooks based on coderabbit feedback
DurgaPrasad-54 86e1f4d
chore(commit): update commit types in workflow and config
DurgaPrasad-54 34b4b63
fix(ci): ignore merge commits in commit message validation
DurgaPrasad-54 4c12455
refactor(ci): replace regex commit check with commitlint validation
DurgaPrasad-54 eb785ba
fix(ci): run commitlint via npx without local dependency
DurgaPrasad-54 3105959
refactor(ci): use commitlint range validation with pinned version
DurgaPrasad-54 9350b5d
fix(ci): correct git-log-args quoting in commitlint workflow
DurgaPrasad-54 c8f1b65
fix(ci): skip merge commits in commitlint workflow
DurgaPrasad-54 7c81ca0
fix(ci): validate PR commits using commitlint
DurgaPrasad-54 cc0e6dc
docs(readme): add git hooks enable command in setup
DurgaPrasad-54 fa7ad69
refactor(commitlint): define commit rules directly without config-conβ¦
DurgaPrasad-54 0a40616
fix(commitlint): handle exit codes correctly in workflow
DurgaPrasad-54 ca51995
chore(commitlint): update commit-msg hook to use specific commitlint β¦
DurgaPrasad-54 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,4 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| npx --yes @commitlint/cli@20.4.3 --edit "$1" |
This file contains hidden or 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,29 @@ | ||
| name: Commit Message Check | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| jobs: | ||
| commit-check: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Validate commit messages | ||
| run: | | ||
| set -eo pipefail | ||
| commits=$(git log --no-merges --pretty=format:"%H" "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}") | ||
| for sha in $commits; do | ||
| tmp=$(mktemp) | ||
| git log -1 --pretty=format:"%B" "$sha" > "$tmp" | ||
| npx --yes @commitlint/cli@20.4.3 --edit "$tmp" | ||
DurgaPrasad-54 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rm "$tmp" | ||
| done | ||
This file contains hidden or 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 hidden or 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,35 @@ | ||
| module.exports = { | ||
| 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', | ||
| ], | ||
| ], | ||
| }, | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.