From 094a7071e218545095c6ab615544657ac867eae8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 27 Mar 2025 13:54:05 +0000 Subject: [PATCH] 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 --- scripts/fetchdep.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/fetchdep.sh b/scripts/fetchdep.sh index 1c34beaf42..1299815bbb 100755 --- a/scripts/fetchdep.sh +++ b/scripts/fetchdep.sh @@ -45,10 +45,7 @@ getPRInfo() { # Some CIs don't give us enough info, so we just get the PR number and ask the # GH API for more info - "fork:branch". Some give us this directly. -if [ -n "$BUILDKITE_BRANCH" ]; then - # BuildKite - head=$BUILDKITE_BRANCH -elif [ -n "$PR_NUMBER" ]; then +if [ -n "$PR_NUMBER" ]; then # GitHub getPRInfo $PR_NUMBER elif [ -n "$REVIEW_ID" ]; then @@ -79,11 +76,14 @@ if [[ "$GITHUB_EVENT_NAME" == "merge_group" ]]; then clone $deforg $defrepo ${withoutPrefix%%/pr-*} fi -# Try the target branch of the push or PR. -if [ -n "$GITHUB_BASE_REF" ]; then - clone $deforg $defrepo $GITHUB_BASE_REF -elif [ -n "$BUILDKITE_PULL_REQUEST_BASE_BRANCH" ]; then - clone $deforg $defrepo $BUILDKITE_PULL_REQUEST_BASE_BRANCH +# Try the target branch of the push or PR, or the branch that was pushed to +# (ie. the 'master' branch should use matching 'master' dependencies) +base_or_branch=$GITHUB_BASE_REF +if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then + base_or_branch=${GITHUB_REF} +fi +if [ -n "$base_or_branch" ]; then + clone $deforg $defrepo $base_or_branch fi # Try HEAD which is the branch name in Netlify (not BRANCH which is pull/xxxx/head for PR builds)