Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Commit bf1a9eb

Browse files
Allow the pattern update script to fetch pull requests (#44)
* Allow the pattern update script to fetch pull requests * 1 line * 1 line
1 parent 339396c commit bf1a9eb

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

bin/update-patterns

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ function finish {
99
docker rm browser-pattern-library &> /dev/null || true
1010
}
1111

12+
if [[ $# -eq 0 ]]; then
13+
commit=origin/master
14+
elif [[ $# -eq 1 && $1 =~ ^pr-([1-9][0-9])*$ ]]; then
15+
pr=${BASH_REMATCH[1]}
16+
elif [[ $# -eq 1 ]]; then
17+
commit=$1
18+
else
19+
echo "Usage: $0 COMMITISH"
20+
echo "Examples:"
21+
echo "master branch: $0"
22+
echo "specific commit: $0 fd89896"
23+
echo "pull request: $0 pr-50"
24+
exit 1
25+
fi
26+
1227
trap finish EXIT
1328

1429
cd "$(dirname "$0")/.."
@@ -18,11 +33,17 @@ mkdir -p var/pattern-library && cd "$_"
1833
if ! [[ -d .git ]]; then
1934
git clone [email protected]:libero/pattern-library.git .
2035
else
21-
git fetch
22-
git reset --hard origin/master
2336
git clean -d --force
2437
fi
2538

39+
if [[ ${pr+x} ]]; then
40+
git fetch origin "+refs/pull/${pr}/merge"
41+
git checkout --force --quiet FETCH_HEAD
42+
else
43+
git fetch --all --prune
44+
git reset --hard "${commit}"
45+
fi
46+
2647
docker-compose --file docker-compose.yml --file docker-compose.ci.yml build gulp
2748
rm -rf export/*
2849
docker run --name browser-pattern-library pattern-library_gulp npx gulp exportPatterns

0 commit comments

Comments
 (0)