Skip to content

Commit b3e139a

Browse files
committed
fix: don't fail immediately on push error
1 parent 06be3c5 commit b3e139a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/sync.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/usr/bin/env bash
22
set -Eexuo pipefail # abort the script on error
33

4+
# Array to collect errors
5+
declare -a errors
6+
47
# replicate shared data from this repo into all repositories at Ory
58
function replicate_all {
69
# verify arguments
@@ -119,6 +122,15 @@ function replicate_all {
119122
repo_type=${type_map[$repo_name]:-library}
120123
replicate "ory/$repo_name" "$repo_type" "$human_name" "$workspace" "$persist"
121124
done
125+
126+
# Check for errors and exit with a non-zero status if any errors were collected
127+
if [ ${#errors[@]} -ne 0 ]; then
128+
echo "Errors occurred during git push:"
129+
for error in "${errors[@]}"; do
130+
echo "$error"
131+
done
132+
exit 1
133+
fi
122134
}
123135

124136
# replicates the info in this repository into the given target repository
@@ -304,7 +316,9 @@ function push_changes {
304316
local -r repo_path=$1
305317
(
306318
cd "$repo_path"
307-
git push
319+
if ! git push; then
320+
errors+=("Failed to push changes for $repo_path")
321+
fi
308322
)
309323
}
310324

0 commit comments

Comments
 (0)