-
Notifications
You must be signed in to change notification settings - Fork 823
/
sample-to-branch.sh
executable file
·43 lines (34 loc) · 1.07 KB
/
sample-to-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
36
37
38
39
40
41
42
43
#!/bin/bash
set -e
tmp=`mktemp -d`
for sample in dist/samples/*/; do
name=`basename $sample`
branch="sample-${name}"
pushd $tmp
rm -rf .git
git init
git config user.name 'googlemaps-bot'
git config user.email '[email protected]'
if [ -n "$GITHUB_TOKEN" ]; then
git remote add origin "https://googlemaps-bot:[email protected]/googlemaps/js-samples.git"
else
git remote add origin "[email protected]:googlemaps/js-samples.git"
fi
git checkout -B $branch
git rm -rqf . || true
git clean -fxd
popd
cp -r $sample/app/* $tmp
# manually copy all files beginning with .
cp $sample/app/.env $tmp/.env
cp $sample/app/.eslintrc.json $tmp/.eslintrc.json
cp $sample/app/.gitignore $tmp/.gitignore
cp shared/sandbox.config.json $tmp/sandbox.config.json
cp shared/cloud_shell_instructions.md $tmp/cloud_shell_instructions.md
pushd $tmp
git add -A
git commit -am "chore: sync ${name} [skip-ci]" --no-verify || true
git push -q --set-upstream origin $branch -f
git status
popd
done