Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[fix] Add missing deployment-info artifact creation in playwright wor…
…kflows

- Capture wrangler deployment URL output and save to GitHub outputs
- Create deployment-info artifacts with test results and deployment URLs
- Add test exit code tracking in test-ui.yaml workflow
- Add PR number logging for debugging
- Improve URL extraction with multiple patterns and fallback

This fixes the issue where PR comments were missing deployment links because the deployment-info artifacts were never created.
  • Loading branch information
snomiao committed Sep 3, 2025
commit b1498fd6a04f49051f72233ae651cf2aea93f63c
53 changes: 52 additions & 1 deletion .github/workflows/pr-playwright-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:

const pr = pullRequests[0];
console.log(`✅ Found PR #${pr.number} for branch: ${context.payload.workflow_run.head_branch}`);
console.log(`PR number is: ${pr.number}`);
const branchName = context.payload.workflow_run.head_branch;
const sanitizedBranch = branchName.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/--+/g, '-').replace(/^-|-$/g, '');

Expand Down Expand Up @@ -79,14 +80,38 @@ jobs:
RETRY_COUNT=0
MAX_RETRIES=3
SUCCESS=false
DEPLOYMENT_URL=""

while [ $RETRY_COUNT -lt $MAX_RETRIES ] && [ $SUCCESS = false ]; do
RETRY_COUNT=$((RETRY_COUNT + 1))
echo "Deployment attempt $RETRY_COUNT of $MAX_RETRIES..."

if npx wrangler pages deploy playwright-report --project-name=${{ steps.project-name.outputs.name }} --branch=${{ steps.project-name.outputs.branch }}; then
# Capture wrangler output to extract deployment URL
OUTPUT=$(npx wrangler pages deploy playwright-report --project-name=${{ steps.project-name.outputs.name }} --branch=${{ steps.project-name.outputs.branch }} 2>&1)
EXIT_CODE=$?

echo "$OUTPUT"

if [ $EXIT_CODE -eq 0 ]; then
SUCCESS=true
echo "Deployment successful on attempt $RETRY_COUNT"
# Extract the deployment URL from wrangler output
# Look for the URL in various formats that wrangler might output
DEPLOYMENT_URL=$(echo "$OUTPUT" | grep -oE 'https://[a-z0-9.-]+\.pages\.dev(/[^[:space:]]*)?$' | head -1)
if [ -z "$DEPLOYMENT_URL" ]; then
# Try another pattern if the first one fails
DEPLOYMENT_URL=$(echo "$OUTPUT" | grep -oE 'https://[^[:space:]]+\.pages\.dev' | head -1)
fi
if [ -n "$DEPLOYMENT_URL" ]; then
echo "Deployment URL: $DEPLOYMENT_URL"
echo "url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
else
echo "Warning: Could not extract deployment URL from wrangler output"
# Construct expected URL as fallback
FALLBACK_URL="https://${{ steps.project-name.outputs.name }}-${{ steps.project-name.outputs.branch }}.pages.dev"
echo "Using fallback URL: $FALLBACK_URL"
echo "url=$FALLBACK_URL" >> $GITHUB_OUTPUT
fi
else
echo "Deployment failed on attempt $RETRY_COUNT"
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
Expand All @@ -104,6 +129,32 @@ jobs:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

- name: Save deployment info
if: fromJSON(steps.pr-info.outputs.result).number != null && always()
run: |
# Read test exit code from the artifact
TEST_EXIT_CODE="1"
if [ -f "playwright-report/test-exit-code.txt" ]; then
TEST_EXIT_CODE=$(cat playwright-report/test-exit-code.txt)
fi

# Use deployment URL if available, otherwise use a fallback
URL="${{ steps.cloudflare-deploy.outputs.url }}"
if [ -z "$URL" ] || [ "${{ steps.cloudflare-deploy.outcome }}" != "success" ]; then
URL="https://${{ steps.project-name.outputs.name }}-${{ steps.project-name.outputs.branch }}.pages.dev"
fi

echo "${{ matrix.browser }}|$TEST_EXIT_CODE|$URL" > deployment-info.txt
echo "Saved deployment info: ${{ matrix.browser }}|$TEST_EXIT_CODE|$URL"

- name: Upload deployment info
if: fromJSON(steps.pr-info.outputs.result).number != null && always()
uses: actions/upload-artifact@v4
with:
name: deployment-info-${{ matrix.browser }}
path: deployment-info.txt
retention-days: 1

comment-tests-starting:
runs-on: ubuntu-latest
if: github.repository == 'Comfy-Org/ComfyUI_frontend' && github.event.workflow_run.event == 'pull_request' && github.event.action == 'requested'
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/test-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,20 @@ jobs:
id: playwright
run: npx playwright test --project=${{ matrix.browser }} --reporter=html
working-directory: ComfyUI_frontend
continue-on-error: true

- name: Save test exit code
if: always()
run: |
echo "${{ steps.playwright.outcome == 'success' && '0' || '1' }}" > test-exit-code.txt
echo "Test outcome: ${{ steps.playwright.outcome }}"

- uses: actions/upload-artifact@v4
if: always() # note: use always() to allow results to be upload/report even tests failed.
with:
name: playwright-report-${{ matrix.browser }}
path: ComfyUI_frontend/playwright-report/
path: |
ComfyUI_frontend/playwright-report/
test-exit-code.txt
retention-days: 30