Skip to content

Commit 4e06b2b

Browse files
committed
fix: Prevent deployment logs from appearing in PR comment
- Redirect all logging output to stderr in deploy_storybook function - Only return clean URL or 'failed' to stdout for proper capture - Add --commit-dirty=true flag to suppress git warnings - Fix issue where entire deployment output was shown in comment link
1 parent 7c84722 commit 4e06b2b

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

scripts/cicd/pr-storybook-deploy-and-comment.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,39 @@ deploy_storybook() {
2929

3030
[ ! -d "$dir" ] && echo "failed" && return
3131

32-
# Install wrangler if not available
32+
# Install wrangler if not available (redirect to stderr for logging)
3333
if ! command -v wrangler > /dev/null 2>&1; then
34-
echo "Installing wrangler..."
35-
npm install -g wrangler
34+
echo "Installing wrangler..." >&2
35+
npm install -g wrangler >&2
3636
fi
3737

3838
project="comfyui-storybook"
3939

40-
echo "Deploying Storybook to project $project on branch $branch..."
40+
echo "Deploying Storybook to project $project on branch $branch..." >&2
4141

4242
# Try deployment up to 3 times
4343
i=1
4444
while [ $i -le 3 ]; do
45-
echo "Deployment attempt $i of 3..."
45+
echo "Deployment attempt $i of 3..." >&2
4646
if output=$(npx wrangler pages deploy "$dir" \
4747
--project-name="$project" \
48-
--branch="$branch" 2>&1); then
48+
--branch="$branch" \
49+
--commit-dirty=true 2>&1); then
4950

5051
# Extract URL from output
5152
url=$(echo "$output" | grep -oE 'https://[a-z0-9.-]+\.pages\.dev' | head -1)
5253
result="${url:-https://${branch}.${project}.pages.dev}"
53-
echo "Success! URL: $result"
54-
echo "$result"
54+
echo "Success! URL: $result" >&2
55+
echo "$result" # Only this goes to stdout and gets captured
5556
return
5657
else
57-
echo "Deployment failed on attempt $i: $output"
58+
echo "Deployment failed on attempt $i: $output" >&2
5859
fi
5960
[ $i -lt 3 ] && sleep 10
6061
i=$((i + 1))
6162
done
6263

63-
echo "failed"
64+
echo "failed" # Only this goes to stdout on failure
6465
}
6566

6667
# Post or update GitHub comment

0 commit comments

Comments
 (0)