From 1a2d201863e1a61d62b84fefe0760fee622b1d5f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 4 Jul 2023 17:14:29 +0100 Subject: [PATCH] Tweak branch matching to allow not applying outside of PRs for matrix-analytics-events (#11186) --- scripts/ci/install-deps.sh | 20 ++++++++++++-------- scripts/ci/layered.sh | 25 ++++++++++++++----------- scripts/fetchdep.sh | 2 -- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/scripts/ci/install-deps.sh b/scripts/ci/install-deps.sh index 4843fc8879..5fddc09018 100755 --- a/scripts/ci/install-deps.sh +++ b/scripts/ci/install-deps.sh @@ -9,20 +9,24 @@ set -ex -scripts/fetchdep.sh matrix-org matrix-js-sdk +scripts/fetchdep.sh matrix-org matrix-js-sdk develop pushd matrix-js-sdk [ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF yarn link yarn install --frozen-lockfile $@ popd -scripts/fetchdep.sh matrix-org matrix-analytics-events main -pushd matrix-analytics-events -yarn link -yarn install --frozen-lockfile $@ -yarn build:ts -popd +scripts/fetchdep.sh matrix-org matrix-analytics-events +# We don't pass a default branch so cloning may fail when we are not in a PR +# This is expected as this project does not share a release cycle but we still branch match it +if [ -d matrix-analytics-events ]; then + pushd matrix-analytics-events + yarn link + yarn install --frozen-lockfile $@ + yarn build:ts + popd +fi yarn link matrix-js-sdk -yarn link @matrix-org/analytics-events +[ -d matrix-analytics-events ] && yarn link @matrix-org/analytics-events yarn install --frozen-lockfile $@ diff --git a/scripts/ci/layered.sh b/scripts/ci/layered.sh index 55c7e25351..b55cb77647 100755 --- a/scripts/ci/layered.sh +++ b/scripts/ci/layered.sh @@ -14,30 +14,33 @@ set -ex # for the primary repo (react-sdk in this case). # Set up the js-sdk first -scripts/fetchdep.sh matrix-org matrix-js-sdk +scripts/fetchdep.sh matrix-org matrix-js-sdk develop pushd matrix-js-sdk [ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF yarn link yarn install --frozen-lockfile popd -# Also set up matrix-analytics-events so we get the latest from -# the main branch or a branch with matching name -scripts/fetchdep.sh matrix-org matrix-analytics-events main -pushd matrix-analytics-events -yarn link -yarn install --frozen-lockfile -yarn build:ts -popd +# Also set up matrix-analytics-events for branch with matching name +scripts/fetchdep.sh matrix-org matrix-analytics-events +# We don't pass a default branch so cloning may fail when we are not in a PR +# This is expected as this project does not share a release cycle but we still branch match it +if [ -d matrix-analytics-events ]; then + pushd matrix-analytics-events + yarn link + yarn install --frozen-lockfile + yarn build:ts + popd +fi # Now set up the react-sdk yarn link matrix-js-sdk -yarn link @matrix-org/analytics-events +[ -d matrix-analytics-events ] && yarn link @matrix-org/analytics-events yarn link yarn install --frozen-lockfile # Finally, set up element-web -scripts/fetchdep.sh vector-im element-web +scripts/fetchdep.sh vector-im element-web develop pushd element-web yarn link matrix-js-sdk yarn link matrix-react-sdk diff --git a/scripts/fetchdep.sh b/scripts/fetchdep.sh index 3a8b9be4dd..0965e811ad 100755 --- a/scripts/fetchdep.sh +++ b/scripts/fetchdep.sh @@ -6,8 +6,6 @@ deforg="$1" defrepo="$2" defbranch="$3" -[ -z "$defbranch" ] && defbranch="develop" - rm -r "$defrepo" || true # figure out where to look for pull requests: