Try fetching more branches for PRs

Attempt both the PR author's branch and the PR's target branch. This resolves
issues on experimental where we need riot-web to also be experimental.
This commit is contained in:
J. Ryan Stinnett 2018-12-20 22:13:40 +00:00
parent 418bfbb3dc
commit 7affd5fcff

View file

@ -1,22 +1,24 @@
#!/bin/sh #!/bin/sh
set -e
org="$1" org="$1"
repo="$2" repo="$2"
rm -r "$repo" || true rm -r "$repo" || true
curbranch="$TRAVIS_PULL_REQUEST_BRANCH" clone() {
[ -z "$curbranch" ] && curbranch="$TRAVIS_BRANCH" branch=$1
[ -z "$curbranch" ] && curbranch=`"echo $GIT_BRANCH" | sed -e 's/^origin\///'` # jenkins if [ -n "$branch" ]
then
echo "Trying to use the branch $branch"
git clone https://github.com/$org/$repo.git $repo --branch "$branch" && exit 0
fi
}
if [ -n "$curbranch" ] # Try the PR author's branch in case it exists on the deps as well.
then clone $TRAVIS_PULL_REQUEST_BRANCH
echo "Determined branch to be $curbranch" # Try the target branch of the push or PR.
clone $TRAVIS_BRANCH
git clone https://github.com/$org/$repo.git $repo --branch "$curbranch" && exit 0 # Try the current branch from Jenkins.
fi clone `"echo $GIT_BRANCH" | sed -e 's/^origin\///'`
# Use develop as the last resort.
echo "Checking out develop branch" clone develop
git clone https://github.com/$org/$repo.git $repo --branch develop