Skip to content

Commit 094a707

Browse files
authored
Make fetchdep check out matching branch name (#29601)
* Make fetchdep check out matching branch name on a push to a branch. * Remove buildkite support entirely
1 parent a5673f6 commit 094a707

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

scripts/fetchdep.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ getPRInfo() {
4545

4646
# Some CIs don't give us enough info, so we just get the PR number and ask the
4747
# GH API for more info - "fork:branch". Some give us this directly.
48-
if [ -n "$BUILDKITE_BRANCH" ]; then
49-
# BuildKite
50-
head=$BUILDKITE_BRANCH
51-
elif [ -n "$PR_NUMBER" ]; then
48+
if [ -n "$PR_NUMBER" ]; then
5249
# GitHub
5350
getPRInfo $PR_NUMBER
5451
elif [ -n "$REVIEW_ID" ]; then
@@ -79,11 +76,14 @@ if [[ "$GITHUB_EVENT_NAME" == "merge_group" ]]; then
7976
clone $deforg $defrepo ${withoutPrefix%%/pr-*}
8077
fi
8178

82-
# Try the target branch of the push or PR.
83-
if [ -n "$GITHUB_BASE_REF" ]; then
84-
clone $deforg $defrepo $GITHUB_BASE_REF
85-
elif [ -n "$BUILDKITE_PULL_REQUEST_BASE_BRANCH" ]; then
86-
clone $deforg $defrepo $BUILDKITE_PULL_REQUEST_BASE_BRANCH
79+
# Try the target branch of the push or PR, or the branch that was pushed to
80+
# (ie. the 'master' branch should use matching 'master' dependencies)
81+
base_or_branch=$GITHUB_BASE_REF
82+
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
83+
base_or_branch=${GITHUB_REF}
84+
fi
85+
if [ -n "$base_or_branch" ]; then
86+
clone $deforg $defrepo $base_or_branch
8787
fi
8888

8989
# Try HEAD which is the branch name in Netlify (not BRANCH which is pull/xxxx/head for PR builds)

0 commit comments

Comments
 (0)