Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit 51e2ea7

Browse files
committed
modify checkout step
1 parent 0c94c71 commit 51e2ea7

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.github/workflows/reusable_test.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,29 @@ jobs:
7272
- name: Checkout specific branch in submodule
7373
run: |
7474
cd cpp/memgraph
75-
if [ -z "${{ inputs.memgraph_ref }}" ] || ! git checkout "${{ inputs.memgraph_ref }}"; then
76-
# this may happen if we're using a daily build not directly from master
77-
echo "Checkout of '${{ inputs.memgraph_ref }}' failed, checking out master instead."
75+
# If no ref is provided, just checkout master.
76+
if [ -z "${{ inputs.memgraph_ref }}" ]; then
77+
echo "No memgraph_ref provided, checking out master."
7878
git checkout master
79+
else
80+
# Temporarily disable exit-on-error to capture the failure of checkout.
81+
set +e
82+
git checkout "${{ inputs.memgraph_ref }}"
83+
checkout_status=$?
84+
# Re-enable exit-on-error.
85+
set -e
86+
87+
# If the checkout failed, fallback to master.
88+
if [ $checkout_status -ne 0 ]; then
89+
echo "Checkout of '${{ inputs.memgraph_ref }}' failed, checking out master instead."
90+
git checkout master
91+
fi
7992
fi
93+
echo "DEBUG: Last status $?"
8094
8195
# Only pull if we are on a branch.
8296
current_branch=$(git symbolic-ref --short -q HEAD)
97+
echo "Current branch: $current_branch"
8398
if [ -n "$current_branch" ]; then
8499
if [[ "${{ inputs.memgraph_ref_update }}" == "true" ]]; then
85100
git pull

0 commit comments

Comments
 (0)