Skip to content

Commit 603b70f

Browse files
committed
Improve graceful exit when empty builds
1 parent cebacf7 commit 603b70f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ jobs:
7878
fi
7979
8080
- name: Check for builds
81+
id: check-builds
8182
run: |
8283
# Skip if no book-server config
8384
if [[ "${SKIP_BOOK_SERVER}" == "true" ]]; then
8485
echo "📚 Skipping builds check - no book-server configuration"
86+
echo "should_build=false" >> $GITHUB_OUTPUT
8587
exit 0
8688
fi
8789
@@ -91,11 +93,13 @@ jobs:
9193
if [[ "${BUILD_COUNT}" -eq 0 ]]; then
9294
echo "🧱 No builds configured in ${CONFIG_FILE}"
9395
echo "Skipping build deployment."
96+
echo "should_build=false" >> $GITHUB_OUTPUT
9497
exit 0
9598
fi
9699
97100
echo "✅ Build configuration validated:"
98101
echo " Build count: ${BUILD_COUNT}"
102+
echo "should_build=true" >> $GITHUB_OUTPUT
99103
100104
- name: Check if branch is allowed for deployment
101105
id: check-branch
@@ -107,6 +111,13 @@ jobs:
107111
exit 0
108112
fi
109113
114+
# Skip if no builds configured
115+
if [[ "${{ steps.check-builds.outputs.should_build }}" == "false" ]]; then
116+
echo "🧱 Skipping branch check - no builds configured"
117+
echo "should_deploy=false" >> $GITHUB_OUTPUT
118+
exit 0
119+
fi
120+
110121
CURRENT_BRANCH="${{ github.ref_name }}"
111122
IFS=',' read -ra ALLOWED <<< "${DEPLOY_BRANCHES}"
112123
BRANCH_ALLOWED=false

0 commit comments

Comments
 (0)