-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathaddme.sh
executable file
·128 lines (99 loc) · 2.75 KB
/
addme.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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
# This script will add user defined info to members.yml & push those changes to github & make a pull request
count=1
status="Current"
while [ $count == 1 ];
do
echo
echo "Enter your name"
read userName
echo
echo "Enter the name of your profile picture"
echo "Example: octocat.jpg"
read pictureName
count1=1
while [ $count1 == 1 ];
do
echo
echo "Enter the path name to your profile picture"
read picturePath
if [ -e "$picturePath" ];
then
mv "$picturePath" ./assets/images
count1=0
else
echo "Enter a valid path"
fi
done
count2=1
while [ $count2 == 1 ];
do
echo
echo "Enter your email address"
read emailName
if [[ $emailName =~ (.+)@(.+) ]];
then
count2=0
else
echo "invalid email address please try again"
fi
done
echo
echo "Would you like to enter your blog url? (Y/N)"
read rsp
if [ $rsp == "Y" ] || [ $rsp == "y" ];
then
count3=1
while [ $count3 == 1 ];
do
echo "Enter your full blog url"
read blogName
if curl --output /dev/null --silent --head --fail "$blogName"; then
count3=0
else
echo "Enter a valid website"
fi
done
else
blogName=""
fi
echo
echo "Name: "$userName
echo "Picture Name: "$pictureName
echo "Email: "$emailName
echo "Blog: "$blogName
echo
echo "Is this information correct? (Y/N)"
read rsp1
if [ $rsp1 == "Y" ] || [ $rsp1 == "y" ];
then
count=0
fi
done
echo >> "./_data/members.yml"
echo "- name: $userName" >> "./_data/members.yml"
echo " status: $status" >> "./_data/members.yml"
echo " image_url: /assets/images/$pictureName" >> "./_data/members.yml"
echo " position: Undergraduate Reasearch Assistant" >> "./_data/members.yml"
echo " email: $emailName" >> "./_data/members.yml"
echo " blog: $blogName" >> "./_data/members.yml"
echo
echo "Would you like to stage a pull request at this time? (Y/N)"
read rsp2
if [ $rsp2 == "Y" ] || [ $rsp2 == "y" ];
then
echo
echo "Enter the name of your forked github repository of CIRDLES/cirdles.github.com"
read repoName
echo
echo "Enter the name of the current local branch"
read branchName
echo
echo "Enter your github user name"
read githubName
git add _data/members.yml
git add assets/images
git commit -m "Added new member $userName"
git push origin $branchName
hub pull-request "Added new member $userName" -b CIRDLES/cirdles.github.com:master -h $githubName/$repoName:$branchName
fi