Skip to content

Commit f797ca1

Browse files
authored
throw errors when translations fail to fetch during build (#58781)
1 parent abe27e9 commit f797ca1

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/deployments/production/build-scripts/clone-or-use-cached-repo.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,21 @@ clone_or_use_cached_repo() {
1919
cd "$repo_name"
2020

2121
# Fetch latest changes
22-
git fetch origin "$branch"
23-
git checkout "$branch"
24-
git pull origin "$branch"
22+
if ! git fetch origin "$branch"; then
23+
echo "❌ Failed to fetch repository '$repo_name'"
24+
cd ..
25+
return 1
26+
fi
27+
if ! git checkout "$branch"; then
28+
echo "❌ Failed to checkout branch '$branch' in repository '$repo_name'"
29+
cd ..
30+
return 1
31+
fi
32+
if ! git pull origin "$branch"; then
33+
echo "❌ Failed to pull repository '$repo_name'"
34+
cd ..
35+
return 1
36+
fi
2537

2638
echo "Updated repository '$repo_name' with the latest changes from $branch."
2739

@@ -30,7 +42,10 @@ clone_or_use_cached_repo() {
3042
echo "Cloning repository '$repo_name' from branch '$branch'..."
3143

3244
# We only need the most recent change for production deploys, so we use --depth 1
33-
git clone --depth 1 --branch "$branch" "https://${GITHUB_TOKEN}@github.com/github/$repo_url.git" "$repo_name"
45+
if ! git clone --depth 1 --branch "$branch" "https://${GITHUB_TOKEN}@github.com/github/$repo_url.git" "$repo_name"; then
46+
echo "❌ Failed to clone repository '$repo_name'"
47+
return 1
48+
fi
3449
fi
3550

3651
echo "Repository '$repo_name' is up to date."

0 commit comments

Comments
 (0)