Make CircleCI run shallow clones of the React Native repo (#34453)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34453

# Changelog
[General][Fixed] - Fix shallow cloning break on main.

Introduced in [#34438](https://github.com/facebook/react-native/pull/34438)

Reviewed By: cipolleschi

Differential Revision: D38858746

fbshipit-source-id: c632bad0dd4ed646065a6daa838035dc9ee5caf2
This commit is contained in:
Breadman Da
2022-08-19 03:15:55 -07:00
committed by Facebook GitHub Bot
parent bc84ec42ee
commit fb936dfffb
+9 -2
View File
@@ -134,8 +134,15 @@ commands:
name: Shallow clone repo
command: |
git clone --branch main --no-checkout "$CIRCLE_REPOSITORY_URL" --single-branch .
git fetch --force --depth 1 origin +refs/pull/$CIRCLE_PR_NUMBER/head:refs/remotes/origin/pull/$CIRCLE_PR_NUMBER
git checkout --force -B "$CIRCLE_BRANCH" "$CIRCLE_SHA1"
# Fetch from fork if applicable
if [ -z $CIRCLE_PR_NUMBER ] ; then
git fetch --force --depth 1 origin +refs/pull/$CIRCLE_PR_NUMBER/head:refs/remotes/origin/pull/$CIRCLE_PR_NUMBER
fi
if [ -z $CIRCLE_BRANCH ] ; then
git checkout --force -B "$CIRCLE_BRANCH" "$CIRCLE_SHA1"
else
git checkout main
fi
# Checkout with cache, on machines that are using Docker the cache is ignored
checkout_code_with_cache: