castopod/scripts/lint-commit-msg.sh

20 lines
497 B
Bash
Raw Normal View History

#!/bin/sh
set -e
# see https://github.com/conventional-changelog/commitlint/issues/885
2021-06-23 16:53:31 +02:00
if [ "${CI_COMMIT_BEFORE_SHA}" = "0000000000000000000000000000000000000000" ];
then
echo "commitlint from HEAD^"
2023-02-22 17:59:28 +01:00
pnpx commitlint --from=HEAD^
else
echo "commitlint from ${CI_COMMIT_BEFORE_SHA}"
2021-06-23 16:53:31 +02:00
br=`git branch -r --contains ${CI_COMMIT_BEFORE_SHA}`
if [ ! -n $br ];
then
2023-02-22 17:59:28 +01:00
pnpx commitlint --from=HEAD^
2021-06-23 16:53:31 +02:00
else
2023-02-22 17:59:28 +01:00
pnpx commitlint --from="${CI_COMMIT_BEFORE_SHA}"
2021-06-23 16:53:31 +02:00
fi
fi