blob: 19a550dfd6d71a4dc6939f4a5fcd557398836580 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
function dirty() {
base=~/code/src/github.com/virtyx-technologies
yellow='\033[0;33m'
green='\033[0;32m'
nc='\033[0m'
for repo in $(ls "$base"); do
p="$base/$repo"
is_dirty=$(git --git-dir="$p/.git" --work-tree="$p" diff --shortstat 2> /dev/null | tail -n1)
branch=$(git --git-dir="$p/.git" --work-tree="$p" rev-parse --abbrev-ref HEAD 2> /dev/null)
if [[ $branch != "master" && $branch != "HEAD" ]]; then
pr=$(curl --silent "https://benburwell:$GITHUB_TOKEN@api.github.com/repos/virtyx-technologies/$repo/pulls?state=open&head=virtyx-technologies:$branch" | jq --raw-output --monochrome-output '.[0]._links.html.href')
pr_link=$([[ $pr != "null" ]] && echo "($pr)")
if [[ $is_dirty != "" ]]; then
echo "$repo: ${yellow}$branch${nc} $pr_link"
else
echo "$repo: ${green}$branch${nc} $pr_link"
fi
else
if [[ $is_dirty ]]; then
echo "$repo: ${yellow}$branch${nc} $pr_link"
fi
fi
done
}
|