Skip to content

Commit 95ff5dd

Browse files
InfoTech.io Botclaude
andcommitted
fix: add fallback strategy for missing gh-pages branch
- Add validation for current-site content availability - Implement fallback from preserve-base-site to merge-and-build when no base site exists - Resolve issue where missing gh-pages branch caused workflow failures - Enable graceful degradation for incremental builds when base site unavailable Root cause: GitHub Pages deployed via artifacts (not gh-pages branch) Solution: Auto-fallback to full rebuild when current-site empty/missing Fixes incremental federation builds when no previous site state available. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2156ab5 commit 95ff5dd

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/deploy-github-pages.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ jobs:
5757
path: current-site
5858
continue-on-error: true
5959

60-
- name: Validate Current State
60+
- name: Validate Current State & Apply Fallback
6161
run: |
6262
echo "📦 Checking current site state..."
6363
64-
if [ -d "current-site" ]; then
64+
# Check if we have valid current site content
65+
if [ -d "current-site" ] && [ -n "$(ls -A current-site 2>/dev/null)" ]; then
6566
echo "✅ Current site downloaded"
6667
echo "📊 Current site size: $(du -sh current-site | cut -f1)"
6768
@@ -72,9 +73,16 @@ jobs:
7273
if [ -d "current-site/docs" ]; then
7374
echo "✅ Docs directory exists: $(du -sh current-site/docs | cut -f1)"
7475
fi
76+
77+
# Valid current site found
78+
echo "FALLBACK_TO_FULL=false" >> $GITHUB_ENV
7579
else
76-
echo "⚠️ No existing site found (fresh deployment)"
80+
echo "⚠️ No existing site found (fresh deployment or gh-pages branch missing)"
81+
echo "🔄 Will use full rebuild strategy as fallback"
7782
mkdir -p current-site
83+
84+
# Set fallback flag
85+
echo "FALLBACK_TO_FULL=true" >> $GITHUB_ENV
7886
fi
7987
8088
# ==========================================
@@ -150,6 +158,15 @@ jobs:
150158
exit 1
151159
fi
152160
161+
# CRITICAL FIX: Apply fallback strategy if base site unavailable
162+
if [ "$STRATEGY" = "preserve-base-site" ] && [ "$FALLBACK_TO_FULL" = "true" ]; then
163+
echo "⚠️ Base site unavailable - switching to full rebuild strategy"
164+
echo "🔄 Fallback: preserve-base-site → merge-and-build"
165+
STRATEGY="merge-and-build"
166+
BUILD_CORPORATE="true" # Must rebuild corporate site too
167+
BUILD_DOCS="true"
168+
fi
169+
153170
echo "strategy=$STRATEGY" >> $GITHUB_OUTPUT
154171
echo "build_corporate=$BUILD_CORPORATE" >> $GITHUB_OUTPUT
155172
echo "build_docs=$BUILD_DOCS" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)