Skip to content

Commit

Permalink
fix: bump commitlint to 9.11.0 and make check script work
Browse files Browse the repository at this point in the history
The script to check commit messages was voided, as filenames were no longer passed. This change was
hidden by touching COMMIT_EDITMSG before running the script. This reverts the change to the script
and enables the passthrough of filenames.
  • Loading branch information
FabianScheidt committed Jul 2, 2024
1 parent bb43c4b commit c14c479
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ repos:
- manual
- id: requirements-txt-fixer
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.5.0
rev: v9.11.0
hooks:
- id: commitlint
additional_dependencies: ['@commitlint/config-conventional']
pass_filenames: true
stages:
- commit-msg
- repo: https://github.com/pycqa/isort
Expand Down
7 changes: 0 additions & 7 deletions check_commit_msgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ echo "Getting new commits from ${commit_branch} w.r.t. ${main_branch}"
merge_base=$(git merge-base ${commit_branch} ${main_branch})
rev_list=$(git rev-list --ancestry-path ${merge_base}..${commit_branch})

# check if .git.COMMIT_EDITMSG exists, create dummy file otherwise
# pre-commit commitlint will fail if file does not exist
# this happens on a fresh clone of the repo
if [ ! -f ./.git/COMMIT_EDITMSG ]; then
touch ./.git/COMMIT_EDITMSG
fi

# check commit messages
if [ -n "${rev_list}" ]
then
Expand Down
3 changes: 2 additions & 1 deletion {{cookiecutter.repo_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ repos:
- manual
- id: requirements-txt-fixer
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.5.0
rev: v9.11.0
hooks:
- id: commitlint
additional_dependencies: ['@commitlint/config-conventional']
pass_filenames: true
stages:
- commit-msg
- repo: https://github.com/pycqa/isort
Expand Down
7 changes: 0 additions & 7 deletions {{cookiecutter.repo_name}}/check_commit_msgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ echo "Getting new commits from ${commit_branch} w.r.t. ${main_branch}"
merge_base=$(git merge-base ${commit_branch} ${main_branch})
rev_list=$(git rev-list --ancestry-path ${merge_base}..${commit_branch})

# check if .git.COMMIT_EDITMSG exists, create dummy file otherwise
# pre-commit commitlint will fail if file does not exist
# this happens on a fresh clone of the repo
if [ ! -f ./.git/COMMIT_EDITMSG ]; then
touch ./.git/COMMIT_EDITMSG
fi

# check commit messages
if [ -n "${rev_list}" ]
then
Expand Down

0 comments on commit c14c479

Please sign in to comment.