Compare commits

...

5 Commits

Author SHA1 Message Date
snomiao
9ae3e62a7a Merge branch 'main' of github.com:Comfy-Org/ComfyUI_frontend into sno-fix-playwright-comment 2025-09-05 18:25:02 +00:00
snomiao
2760c0aa72 Trigger CI/CD pipeline 2025-09-04 04:54:34 +00:00
snomiao
b1498fd6a0 [fix] Add missing deployment-info artifact creation in playwright workflows
- 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.
2025-09-03 21:32:54 +00:00
snomiao
8e932fec56 [feat] add console.log when PR number is found 2025-09-02 20:55:39 +00:00
snomiao
83aa561d8a [feat] merge playwright deploy and comment workflows
Combines pr-playwright-deploy.yaml and pr-playwright-comment.yaml into a single workflow to ensure proper dependency ordering. The comment job now waits for deployments to complete before generating comments with deployment URLs.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 03:41:46 +00:00
2 changed files with 69 additions and 4 deletions

View File

@@ -37,6 +37,8 @@ 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, '');
@@ -78,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
@@ -103,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'
@@ -127,7 +179,9 @@ jobs:
return null;
}
return pullRequests[0].number;
const prNumber = pullRequests[0].number;
console.log(`✅ Found PR #${prNumber} for branch: ${context.payload.workflow_run.head_branch}`);
return prNumber;
- name: Get completion time
id: completion-time
@@ -188,7 +242,9 @@ jobs:
return null;
}
return pullRequests[0].number;
const prNumber = pullRequests[0].number;
console.log(`✅ Found PR #${prNumber} for branch: ${context.payload.workflow_run.head_branch}`);
return prNumber;
- name: Download all deployment info
if: steps.pr.outputs.result != 'null'

View File

@@ -231,12 +231,21 @@ 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()
with:
name: playwright-report-${{ matrix.browser }}
path: ComfyUI_frontend/playwright-report/
path: |
ComfyUI_frontend/playwright-report/
test-exit-code.txt
retention-days: 30
# Merge sharded test reports