2021-05-24 14:19:46 +00:00
|
|
|
#!/bin/bash
|
2022-01-18 18:51:25 +00:00
|
|
|
set -e
|
2021-05-24 14:19:46 +00:00
|
|
|
|
|
|
|
# see https://github.com/conventional-changelog/commitlint/issues/885
|
|
|
|
|
2021-06-23 14:53:31 +00:00
|
|
|
if [ "${CI_COMMIT_BEFORE_SHA}" = "0000000000000000000000000000000000000000" ];
|
2021-05-24 14:19:46 +00:00
|
|
|
then
|
|
|
|
echo "commitlint from HEAD^"
|
|
|
|
npx commitlint --from=HEAD^
|
|
|
|
else
|
|
|
|
echo "commitlint from ${CI_COMMIT_BEFORE_SHA}"
|
2021-06-23 14:53:31 +00:00
|
|
|
br=`git branch -r --contains ${CI_COMMIT_BEFORE_SHA}`
|
|
|
|
if [ ! -n $br ];
|
|
|
|
then
|
|
|
|
npx commitlint --from=HEAD^
|
|
|
|
else
|
|
|
|
npx commitlint --from="${CI_COMMIT_BEFORE_SHA}"
|
|
|
|
fi
|
2021-05-24 14:19:46 +00:00
|
|
|
fi
|