2021-12-09 18:15:04 +08:00
|
|
|
#!/bin/bash
|
2021-12-10 10:45:54 +08:00
|
|
|
# author emaill will be jenkins's email, when the pr branch is not fast forward compared with master branch
|
2021-12-16 09:19:22 +08:00
|
|
|
# Exit immediately for non zero status
|
2021-12-09 18:15:04 +08:00
|
|
|
set -e
|
|
|
|
function get_author_email(){
|
|
|
|
email=$(git --no-pager show -s --format=\'%ae\' HEAD )
|
2021-12-27 15:01:08 +08:00
|
|
|
# Get last commit author when Jenkins submit a merge commit
|
2021-12-09 22:03:07 +08:00
|
|
|
if [[ "${email}" == \'nobody@nowhere\' ]]; then
|
2021-12-09 18:15:04 +08:00
|
|
|
email=$(git --no-pager show -s --format=\'%ae\' HEAD^ )
|
|
|
|
fi
|
|
|
|
echo ${email} | sed $'s/\'//g'
|
|
|
|
}
|
|
|
|
get_author_email
|