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