Skip to content

Commit fad2f5d

Browse files
committed
ci: fix git checkout after baseline generation and improve error handling
1 parent 88d2c08 commit fad2f5d

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

.github/workflows/build-ultraplot.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ jobs:
166166
echo "FILTERED_NODEIDS_BASE=${FILTERED_NODEIDS}"
167167
if [ -z "${FILTERED_NODEIDS}" ]; then
168168
echo "No valid nodeids found on base; skipping baseline generation."
169-
exit 0
170169
else
171170
echo "=== Memory before baseline generation ===" && free -h
172171
pytest -n ${PYTEST_WORKERS} --dist loadfile --tb=short --disable-warnings -W ignore \
@@ -179,19 +178,27 @@ jobs:
179178
status=0
180179
fi
181180
fi
182-
exit "$status"
181+
# Return to the PR branch before continuing
182+
if [ -n "${{ github.event.pull_request.base.sha }}" ]; then
183+
echo "Checking out PR branch: ${{ github.sha }}"
184+
git checkout ${{ github.sha }} || echo "Warning: git checkout failed, but continuing"
185+
fi
186+
if [ "$status" -ne 0 ]; then
187+
echo "Baseline generation failed with status $status"
188+
exit "$status"
189+
fi
183190
else
184191
echo "=== Memory before baseline generation ===" && free -h
185192
pytest -n ${PYTEST_WORKERS} --dist loadfile --tb=short --disable-warnings -W ignore \
186193
--mpl-generate-path=./ultraplot/tests/baseline/ \
187194
--mpl-default-style="./ultraplot.yml" \
188195
ultraplot/tests
189196
echo "=== Memory after baseline generation ===" && free -h
190-
fi
191-
192-
# Return to the PR branch for the rest of the job
193-
if [ -n "${{ github.event.pull_request.base.sha }}" ]; then
194-
git checkout ${{ github.sha }}
197+
# Return to the PR branch for the rest of the job
198+
if [ -n "${{ github.event.pull_request.base.sha }}" ]; then
199+
echo "Checking out PR branch: ${{ github.sha }}"
200+
git checkout ${{ github.sha }} || echo "Warning: git checkout failed, but continuing"
201+
fi
195202
fi
196203
197204
# Image Comparison (Uses cached or newly generated baseline)

0 commit comments

Comments
 (0)