-
Notifications
You must be signed in to change notification settings - Fork 0
/
plumedbot
executable file
·72 lines (50 loc) · 1.42 KB
/
plumedbot
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
#! /bin/bash
set -e
set -x
## change user
git config user.email "[email protected]"
git config user.name "plumedbot"
# clone plumed repo
git clone https://github.com/plumed/plumed2.git
# go to plumed repo
cd plumed2
# add plumedbot/plumed2 fork
set +x # this is not to show the GIT_TOKEN on Travis log
git remote add plumedbot https://plumedbot:[email protected]/plumedbot/plumed2.git
cat > $HOME/.config/hub << EOF
github.com:
- user: plumedbot
oauth_token: $GIT_TOKEN
protocol: https
EOF
set -x
# loop over arguments
for branch
do
git checkout $branch
hash=$( git log -1 --format="%h")
newbranch=$branch-$hash
git checkout -b $newbranch
changes=false
make -C src/lib/ dirslinks
cd src && ./header.sh && cd -
cat > commit-$newbranch << EOF
Plumedbot commit: headers
This commit contains changes automatically generated by plumedbot on Travis-ci.
EOF
if git commit -F commit-$newbranch
then
changes=true
fi
if [ "$changes" = true ] ; then
echo "Pushing to plumedbot"
# -q and 2> is not to show the GIT_TOKEN on Travis log
git push -q -f plumedbot $newbranch 2> /dev/null
cat > pull-request-$newbranch << EOF
Plumedbot pull request
This pull request contains changes in headers automatically generated by plumedbot on Travis-ci.
Please review them and, if correct, merge them to branch $branch.
EOF
hub pull-request -F pull-request-$newbranch -h plumedbot/plumed2:$newbranch -b plumed/plumed2:$branch
fi
done