Skip to content

Commit

Permalink
feat: update commilint version
Browse files Browse the repository at this point in the history
  • Loading branch information
Tzatziou, Vasileios authored and pppmlt committed Aug 11, 2023
1 parent b666f38 commit 2f2e81e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- manual
- id: requirements-txt-fixer
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v7.0.1
rev: v9.5.0
hooks:
- id: commitlint
additional_dependencies: ['@commitlint/config-conventional']
Expand Down
9 changes: 8 additions & 1 deletion check_commit_msgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ 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 All @@ -69,4 +76,4 @@ else
# no commits to check
echo "Did not find any commits to check..."
fi
echo "Sucessfully finished checking commit messages."
echo "Successfully finished checking commit messages."
1 change: 1 addition & 0 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dependencies:
- pylint=2.16.1
- pytest=7.2.1
- cookiecutter=2.1.1
- pytest=7.2.1
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- manual
- id: requirements-txt-fixer
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v7.0.1
rev: v9.5.0
hooks:
- id: commitlint
additional_dependencies: ['@commitlint/config-conventional']
Expand Down
9 changes: 8 additions & 1 deletion {{cookiecutter.repo_name}}/check_commit_msgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ 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 All @@ -69,4 +76,4 @@ else
# no commits to check
echo "Did not find any commits to check..."
fi
echo "Sucessfully finished checking commit messages."
echo "Successfully finished checking commit messages."

0 comments on commit 2f2e81e

Please sign in to comment.