1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-30 11:28:21 +00:00
trezor-firmware/ci/check_release_commit_messages.sh

34 lines
971 B
Bash
Raw Normal View History

#!/usr/bin/env bash
fail=0
2020-08-04 19:21:44 +00:00
git fetch origin master
# list all commits between HEAD and master
for commit in $(git rev-list origin/master..)
do
message=$(git log -n1 --format=%B $commit)
echo "Checking $commit"
# The commit message must contain either
# 1. "cherry-picked from [some commit in master]"
if [[ $message =~ "(cherry picked from commit" ]]; then
2020-06-07 19:49:06 +00:00
# remove last ")" and extract commit hash
master_commit=$(echo ${message:0:-1} | tr ' ' '\n' | tail -1)
# check if master really contains this commit hash
2020-08-04 11:45:00 +00:00
if [[ $(git branch -a --contains $master_commit | grep --only-matching "remotes/origin/master") == "remotes/origin/master" ]]; then
continue
fi
fi
# 2. [RELEASE ONLY] substring
if [[ $message =~ "[RELEASE ONLY]" ]]; then
continue
fi
fail=1
echo "FAILURE! Neither 'cherry picked from..' nor '[RELEASE ONLY]' substring found in this commit message."
done
exit $fail