Skip to content

Commit

Permalink
ci(commitlint): do not check merge commit's ancestors (reanahub#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonadoni committed Mar 22, 2024
1 parent 4990c86 commit 6b9a43b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ check_commitlint () {
npx commitlint --from="$from" --to="$to"
found=0
while IFS= read -r line; do
if echo "$line" | grep -qP "\(\#$pr\)$"; then
commit_hash=$(echo "$line" | cut -d ' ' -f 1)
message=$(echo "$line" | cut -d ' ' -f 2-)
if echo "$message" | grep -qP "\(\#$pr\)$"; then
true
elif echo "$line" | grep -qP "^chore\(.*\): release"; then
elif echo "$message" | grep -qP "^chore\(.*\): release"; then
true
else
echo "✖ Headline does not end by '(#$pr)' PR number: $line"
echo "✖ Headline does not end by '(#$pr)' PR number: $message"
found=1
fi
done < <(git log "$from..$to" --format="%s")
parents=$(git rev-list --parents "$commit_hash" -n1 | awk '{print NF-1}')
if [ "$parents" -gt 1 ]; then
break
fi
done < <(git log "$from..$to" --format="%H %s")
if [ $found -gt 0 ]; then
exit 1
fi
Expand Down

0 comments on commit 6b9a43b

Please sign in to comment.