-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
49 lines (35 loc) · 1.36 KB
/
update.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
#!/bin/bash
set -o errexit -o nounset
if [ -a ./.env ]; then
echo "Loading local .env"
. ./.env
fi
if [ "$TRAVIS_BRANCH" != "master" ]
then
echo "This commit was made against the $TRAVIS_BRANCH and not the master! No deploy!"
exit 0
fi
rev=$(git rev-parse --short HEAD)
rm -rf _build
mkdir _build
cd _build
branch="feature/$(date +"%Y%m%d%H%M%S")-trello-update"
git init
git config user.name "ValidationFailBot"
git config user.email "[email protected]"
git remote add upstream "https://[email protected]/pke/emailvalidation.fail.git"
git fetch upstream master:"${branch}" --depth 1
git checkout "${branch}"
baseUri="https://api.trello.com/1/lists"
cardFields="cards?fields=name,desc,date,cover&attachments=true&actions=emailCard,cardCreate&key=${TRELLO_KEY}&token=${TRELLO_TOKEN}"
failsUri="${baseUri}/${TRELLO_FAILS_LIST}/${cardFields}"
unfailsUri="${baseUri}/${TRELLO_UNFAILS_LIST}/${cardFields}"
echo "Loading fails"
curl --fail --silent "${failsUri}" | node <<< "var o = $(cat); console.log(JSON.stringify(o, null, 2));" > ./docs/_data/fails.json
echo "Loading unfails"
curl --fail --silent "${unfailsUri}" | node <<< "var o = $(cat); console.log(JSON.stringify(o, null, 2));" > ./docs/_data/unfails.json
git add -A .
git commit -m "chore: Rebuild pages at ${rev}"
git checkout master
git merge "${branch}"
git push -q upstream HEAD:master