GitHubのプルリクエストがマージされているか確認するシェルスクリプト
fuji44
かなりやっつけ仕事。
#!/bin/bash
CMDNAME=`basename $0`
if [ $# -ne 2 ]; then
echo "引数が2つ必要です"
_printUsage
fi
# FROM="v4.2.18"
FROM=$1
# TO="HEAD"
TO=$2
prNumberList=(
86
96
100
109
110
)
COLOR_OK="\e[32m"
COLOR_NG="\e[37;41;1m"
COLOR_END="\e[m"
for prNumber in ${prNumberList[@]}; do
result=`git --no-pager log --oneline --merges --grep="Merge pull request #${prNumber} " $FROM...$TO`
if [ -n "$result" ]; then
echo -e "${prNumber} ${COLOR_OK}OK${COLOR_END} $result" | awk '{printf "#%-5s %2s | %s From:%s\n",$1,$2,$3,$NF}'
else
echo -e "${prNumber} ${COLOR_NG}NG${COLOR_END}" | awk '{printf "#%-5s %2s | Not found\n",$1,$2,$3}'
fi
done