Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit f92707c

Browse files
committed
Fix branch matching for build steps
1 parent 6102a6e commit f92707c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

scripts/fetchdep.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,18 @@ elif [ -n "$REVIEW_ID" ]; then
4949
getPRInfo $REVIEW_ID
5050
fi
5151

52-
# $head will always be in the format "fork:branch", so we split it by ":" into
53-
# an array. The first element will then be the fork and the second the branch.
54-
# Based on that we clone
52+
# for forks, $head will be in teh format "fork:branch", so we split it by ":"
53+
# into an array. On non-forks, this has the effect of splitting into a single
54+
# element array given ":" shouldn't appear in the head - it'll just be the
55+
# branch name. Based on the results, we clone.
5556
BRANCH_ARRAY=(${head//:/ })
56-
clone ${BRANCH_ARRAY[0]} $defrepo ${BRANCH_ARRAY[1]}
57+
TRY_ORG=$deforg
58+
TRY_BRANCH=${BRANCH_ARRAY[0]}
59+
if [[ "$head" == *":"* ]]; then
60+
TRY_ORG=${BRANCH_ARRAY[0]}
61+
TRY_BRANCH=${BRANCH_ARRAY[1]}
62+
fi
63+
clone ${TRY_ORG} $defrepo ${TRY_BRANCH}
5764

5865
# Try the target branch of the push or PR.
5966
if [ -n $GITHUB_BASE_REF ]; then

0 commit comments

Comments
 (0)