-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate-default-branch.sh
executable file
·36 lines (27 loc) · 1.18 KB
/
update-default-branch.sh
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
#!/bin/bash
#
# small script to update the default branch for all projects
if [ -z $1 ] || [ -z $2 ]; then
echo ""
echo "************************************************************************************"
echo "* *"
echo "* Usage: ./update-default-branch.sh <project list> <branch name> *"
echo "* Example: ./update-default-branch.sh project-list android-7.0 *"
echo "* *"
echo "************************************************************************************"
echo ""
exit 0
fi
while read file;
do
rm -rf .tmp
echo "$file" > .tmp
project=`cat .tmp | awk '{print $1}'`
echo ""
echo "====================================================================="
echo " PROJECT NAME: {$project}"
echo " BRANCH NAME: {$2}"
echo "====================================================================="
echo ""
curl -u jakew02 -d "{\"name\":\"$project\", \"default_branch\":\"$2\"}" https://api.github.com/repos/jakew02/$project
done < project-list