Skip to content

Commit aaaa2e2

Browse files
committed
fix(dpcs): handle edge case for CACHED_COMMIT_REF in Netlify ignore script
1 parent 0046f64 commit aaaa2e2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

barretenberg/docs/scripts/netlify-ignore-build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ if [ "${BRANCH:-}" = "$BASE_BRANCH" ]; then
2323
echo "Production deploy without cached commit reference - proceeding with build"
2424
exit 1
2525
fi
26+
27+
# Handle edge case where CACHED_COMMIT_REF equals COMMIT_REF
28+
# This happens on first deploys or when Netlify's cache is in an unexpected state
29+
if [ "$CACHED_COMMIT_REF" = "$COMMIT_REF" ]; then
30+
echo "CACHED_COMMIT_REF equals COMMIT_REF ($COMMIT_REF) - cannot determine changes, proceeding with build"
31+
exit 1
32+
fi
33+
2634
COMPARE_REF="$CACHED_COMMIT_REF"
2735
echo "Production deploy: comparing $COMMIT_REF against last deployed commit $COMPARE_REF"
2836
else

docs/scripts/netlify-ignore-build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ if [ "${BRANCH:-}" = "$BASE_BRANCH" ]; then
2323
echo "Production deploy without cached commit reference - proceeding with build"
2424
exit 1
2525
fi
26+
27+
# Handle edge case where CACHED_COMMIT_REF equals COMMIT_REF
28+
# This happens on first deploys or when Netlify's cache is in an unexpected state
29+
if [ "$CACHED_COMMIT_REF" = "$COMMIT_REF" ]; then
30+
echo "CACHED_COMMIT_REF equals COMMIT_REF ($COMMIT_REF) - cannot determine changes, proceeding with build"
31+
exit 1
32+
fi
33+
2634
COMPARE_REF="$CACHED_COMMIT_REF"
2735
echo "Production deploy: comparing $COMMIT_REF against last deployed commit $COMPARE_REF"
2836
else

0 commit comments

Comments
 (0)