forked from googlemaps/js-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample-to-branch.sh
More file actions
executable file
·40 lines (32 loc) · 960 Bytes
/
sample-to-branch.sh
File metadata and controls
executable file
·40 lines (32 loc) · 960 Bytes
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
#!/bin/bash
set -e
tar xf $1
tmp=`mktemp -d`
for sample in 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 'googlemaps-bot@users.noreply.github.com'
if [ -n "$GITHUB_TOKEN" ]; then
git remote add origin "https://googlemaps-bot:$GITHUB_TOKEN@github.com/googlemaps/js-samples.git"
else
git remote add origin "git@github.com:googlemaps/js-samples.git"
fi
git checkout -B $branch
git rm -rqf . || true
git clean -fxd
popd
cp -r $sample/app/* $tmp
cp $sample/app/.env $tmp/.env
cp $sample/app/.*.yml $tmp/
cp $sample/app/.gitignore $tmp/.gitignore
cp $sample/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
popd
done