mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
Restore the ComfyUI animated favicon loading indicator to PR status comments that was removed in PR #5209 when workflow architecture was restructured. The loading GIF now appears in: - Playwright test status comments (pr-playwright-comment.yaml) - Storybook build status comments (pr-storybook-comment.yaml) This provides visual continuity and branding consistency during CI operations, replacing generic hourglass emoji with ComfyUI's animated logo.
164 lines
6.4 KiB
YAML
164 lines
6.4 KiB
YAML
name: PR Playwright Comment
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ['Tests CI']
|
|
types: [requested, completed]
|
|
|
|
env:
|
|
DATE_FORMAT: '+%m/%d/%Y, %I:%M:%S %p'
|
|
|
|
jobs:
|
|
comment-summary:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'Comfy-Org/ComfyUI_frontend' && github.event.workflow_run.event == 'pull_request'
|
|
permissions:
|
|
pull-requests: write
|
|
actions: read
|
|
steps:
|
|
- name: Get PR number
|
|
id: pr
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const { data: pullRequests } = await github.rest.pulls.list({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
state: 'open',
|
|
head: `${context.repo.owner}:${context.payload.workflow_run.head_branch}`,
|
|
});
|
|
|
|
if (pullRequests.length === 0) {
|
|
console.log('No open PR found for this branch');
|
|
return null;
|
|
}
|
|
|
|
return pullRequests[0].number;
|
|
|
|
- name: Log when no PR found
|
|
if: steps.pr.outputs.result == 'null'
|
|
run: |
|
|
echo "⚠️ No open PR found for branch: ${{ github.event.workflow_run.head_branch }}"
|
|
echo "Workflow run ID: ${{ github.event.workflow_run.id }}"
|
|
echo "Repository: ${{ github.event.workflow_run.repository.full_name }}"
|
|
echo "Event: ${{ github.event.workflow_run.event }}"
|
|
|
|
- name: Generate comment body for start
|
|
if: steps.pr.outputs.result != 'null' && github.event.action == 'requested'
|
|
id: comment-body-start
|
|
run: |
|
|
echo "<!-- PLAYWRIGHT_TEST_STATUS -->" > comment.md
|
|
echo "## 🎭 Playwright Test Results" >> comment.md
|
|
echo "" >> comment.md
|
|
echo "<img alt='comfy-loading-gif' src='https://github.com/user-attachments/assets/755c86ee-e445-4ea8-bc2c-cca85df48686' width='14px' height='14px' style='vertical-align: middle; margin-right: 4px;' /> **Tests are starting...** " >> comment.md
|
|
echo "" >> comment.md
|
|
echo "⏰ Started at: ${{ steps.completion-time.outputs.time }} UTC" >> comment.md
|
|
echo "" >> comment.md
|
|
echo "### 🚀 Running Tests" >> comment.md
|
|
echo "- 🧪 **chromium**: Running tests..." >> comment.md
|
|
echo "- 🧪 **chromium-0.5x**: Running tests..." >> comment.md
|
|
echo "- 🧪 **chromium-2x**: Running tests..." >> comment.md
|
|
echo "- 🧪 **mobile-chrome**: Running tests..." >> comment.md
|
|
echo "" >> comment.md
|
|
echo "---" >> comment.md
|
|
echo "⏱️ Please wait while tests are running across all browsers..." >> comment.md
|
|
|
|
- name: Download all deployment info
|
|
if: steps.pr.outputs.result != 'null' && github.event.action == 'completed'
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
run-id: ${{ github.event.workflow_run.id }}
|
|
pattern: deployment-info-*
|
|
merge-multiple: true
|
|
path: deployment-info
|
|
|
|
- name: Get completion time
|
|
id: completion-time
|
|
run: echo "time=$(date -u '${{ env.DATE_FORMAT }}')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Generate comment body for completion
|
|
if: steps.pr.outputs.result != 'null' && github.event.action == 'completed'
|
|
id: comment-body-completed
|
|
run: |
|
|
echo "<!-- PLAYWRIGHT_TEST_STATUS -->" > comment.md
|
|
echo "## 🎭 Playwright Test Results" >> comment.md
|
|
echo "" >> comment.md
|
|
|
|
# Check if all tests passed
|
|
ALL_PASSED=true
|
|
for file in deployment-info/*.txt; do
|
|
if [ -f "$file" ]; then
|
|
browser=$(basename "$file" .txt)
|
|
info=$(cat "$file")
|
|
exit_code=$(echo "$info" | cut -d'|' -f2)
|
|
if [ "$exit_code" != "0" ]; then
|
|
ALL_PASSED=false
|
|
break
|
|
fi
|
|
fi
|
|
done
|
|
|
|
if [ "$ALL_PASSED" = "true" ]; then
|
|
echo "✅ **All tests passed across all browsers!**" >> comment.md
|
|
else
|
|
echo "❌ **Some tests failed!**" >> comment.md
|
|
fi
|
|
|
|
echo "" >> comment.md
|
|
echo "⏰ Completed at: ${{ steps.completion-time.outputs.time }} UTC" >> comment.md
|
|
echo "" >> comment.md
|
|
echo "### 📊 Test Reports by Browser" >> comment.md
|
|
|
|
for file in deployment-info/*.txt; do
|
|
if [ -f "$file" ]; then
|
|
browser=$(basename "$file" .txt)
|
|
info=$(cat "$file")
|
|
exit_code=$(echo "$info" | cut -d'|' -f2)
|
|
url=$(echo "$info" | cut -d'|' -f3)
|
|
|
|
# Validate URLs before using them in comments
|
|
sanitized_url=$(echo "$url" | grep -E '^https://[a-z0-9.-]+\.pages\.dev(/.*)?$' || echo "INVALID_URL")
|
|
if [ "$sanitized_url" = "INVALID_URL" ]; then
|
|
echo "Invalid deployment URL detected: $url"
|
|
url="#" # Use safe fallback
|
|
fi
|
|
|
|
if [ "$exit_code" = "0" ]; then
|
|
status="✅"
|
|
else
|
|
status="❌"
|
|
fi
|
|
|
|
echo "- $status **$browser**: [View Report]($url)" >> comment.md
|
|
fi
|
|
done
|
|
|
|
echo "" >> comment.md
|
|
echo "---" >> comment.md
|
|
if [ "$ALL_PASSED" = "true" ]; then
|
|
echo "🎉 Your tests are passing across all browsers!" >> comment.md
|
|
else
|
|
echo "⚠️ Please check the test reports for details on failures." >> comment.md
|
|
fi
|
|
|
|
- name: Comment PR - Tests Started
|
|
if: steps.pr.outputs.result != 'null' && github.event.action == 'requested'
|
|
uses: edumserrano/find-create-or-update-comment@82880b65c8a3a6e4c70aa05a204995b6c9696f53 # v3.0.0
|
|
with:
|
|
issue-number: ${{ steps.pr.outputs.result }}
|
|
body-includes: '<!-- PLAYWRIGHT_TEST_STATUS -->'
|
|
comment-author: 'github-actions[bot]'
|
|
edit-mode: replace
|
|
body-path: comment.md
|
|
|
|
- name: Comment PR - Tests Complete
|
|
if: steps.pr.outputs.result != 'null' && github.event.action == 'completed'
|
|
uses: edumserrano/find-create-or-update-comment@82880b65c8a3a6e4c70aa05a204995b6c9696f53 # v3.0.0
|
|
with:
|
|
issue-number: ${{ steps.pr.outputs.result }}
|
|
body-includes: '<!-- PLAYWRIGHT_TEST_STATUS -->'
|
|
comment-author: 'github-actions[bot]'
|
|
edit-mode: replace
|
|
body-path: comment.md
|