-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-status.sh
More file actions
executable file
·93 lines (81 loc) · 2.45 KB
/
git-status.sh
File metadata and controls
executable file
·93 lines (81 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
unsynced_repos=()
invalid_repos=()
feature_branch_repos=()
cd /Users/dan/github
for org in $( ls -1 | egrep -v "MCC-Students|BankUnited-Terraform|Ciitizen|pymetrics|invitae-internal" )
do
echo "checking if ORG:${org} is a valid dir"
if [[ -d "${org}" ]]
then
echo "ORG:${org} is a valid dir"
echo "changing dir to ORG:${org}"
cd $org
for repo in $( ls -1 | egrep -v "aws-firewall-manager|ciitizen-dms|my-gha-workflows|tf-huma" )
do
echo "checking if REPO:${repo} is a valid dir"
if [[ -d "${repo}" ]]
then
echo "REPO:${repo} is a valid dir"
echo "changing dir to REPO:${repo}"
cd $repo
echo "***********************************************"
echo "* ${repo}"
echo "***********************************************"
git status --porcelain
if [ $? -ne 0 ]
then
echo "Repo is INVALID"
invalid_repos+=("${org}/${repo}")
else
if [[ `git status --porcelain` ]]
then
# repo is out of sync
echo "Repo is OUT OF SYNC"
unsynced_repos+=("${org}/${repo}")
else
# repo is up to date
echo "No changes"
fi
# check if not on main branch
current_branch=`git branch --show-current`
if [[ $current_branch != "main" ]] && [[ $current_branch != "master" ]]
then
echo "Feature branch: ${current_branch}"
feature_branch_repos+=("${org}/${repo}(${current_branch})")
fi
fi
echo "----------------------------------------------\n"
cd ..
else
echo "skipping repository ${repo}, not a dir"
fi
done
cd ..
else
echo "skipping organization ${org}, not a dir"
fi
done
echo "\n\n====================================================="
echo "Out of sync repos"
echo "====================================================="
for repo in ${unsynced_repos[@]}
do
echo $repo
done
echo ""
echo "====================================================="
echo "Invalid repos"
echo "====================================================="
for repo in ${invalid_repos[@]}
do
echo $repo
done
echo ""
echo "====================================================="
echo "Repos not on main branch"
echo "====================================================="
for repo in ${feature_branch_repos[@]}
do
echo $repo
# echo ""
done