chore(workflow): enhance Playwright expectations update workflow to support issue comments and improve conditional checks for triggering updates

This commit is contained in:
snomiao
2025-10-08 21:53:37 +00:00
parent 064d5a67b2
commit b309eb8f40

View File

@@ -3,39 +3,57 @@ name: Update Playwright Expectations
on:
pull_request:
types: [ labeled ]
types: [labeled]
issue_comment:
types: [created]
jobs:
test:
runs-on: ubuntu-latest
if: github.event.label.name == 'New Browser Test Expectations'
if: >
( github.event_name == 'pull_request' && github.event.label.name == 'New Browser Test Expectations' ) ||
( github.event.issue.pull_request &&
github.event_name == 'issue_comment' &&
(
github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR'
) &&
startsWith(github.event.comment.body, '/update-playwright') )
steps:
- name: Checkout workflow repo
uses: actions/checkout@v5
- name: Setup ComfyUI Server
uses: ./.github/actions/setup-comfyui-server
- name: Setup Playwright
uses: ./.github/actions/setup-playwright
- name: Run Playwright tests and update snapshots
id: playwright-tests
run: pnpm exec playwright test --update-snapshots
continue-on-error: true
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: ./playwright-report/
retention-days: 30
- name: Debugging info
run: |
echo "Branch: ${{ github.head_ref }}"
git status
- name: Commit updated expectations
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git fetch origin ${{ github.head_ref }}
git checkout -B ${{ github.head_ref }} origin/${{ github.head_ref }}
git add browser_tests
git commit -m "[automated] Update test expectations"
git push origin HEAD:${{ github.head_ref }}
- name: Initial Checkout
uses: actions/checkout@v5
- name: Pull Request Checkout
run: gh pr checkout ${{ github.event.issue.number }}
if: github.event.issue.pull_request && github.event_name == 'issue_comment'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup ComfyUI Server
uses: ./.github/actions/setup-comfyui-server
- name: Setup Frontend
uses: ./.github/actions/setup-frontend
- name: Setup Playwright
uses: ./.github/actions/setup-playwright
- name: Run Playwright tests and update snapshots
id: playwright-tests
run: pnpm exec playwright test --update-snapshots
continue-on-error: true
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: ./playwright-report/
retention-days: 30
- name: Debugging info
run: |
echo "PR: ${{ github.event.issue.number }}"
git status
- name: Commit updated expectations
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add browser_tests
git diff --cached --quiet || git commit -m "[automated] Update test expectations"
git push
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}