mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Automatically removes the `New Browser Test Expectations` label after the Playwright expectations update workflow completes. ## Changes - Added a cleanup step to `.github/workflows/update-playwright-expectations.yaml` that removes the label using `gh pr edit --remove-label` - Uses `if: always() && github.event_name == 'pull_request'` to ensure: - The label is removed even if the workflow fails - The label is only removed when triggered by the label event (not the `/update-playwright` comment trigger) ## Benefits - Cleaner PR label management - Labels can be re-applied to trigger additional expectations updates without manual cleanup - Consistent with the claude-review workflow pattern - Reduces noise in the PR interface ## Context This is part of a broader effort to automatically clean up temporary action-triggering labels across all workflows. The first PR in this series (#5983) added the same functionality to the claude-review workflow. ## Test Plan - Apply the `New Browser Test Expectations` label to a PR to verify the workflow removes it automatically after completion ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5998-feat-Auto-remove-New-Browser-Test-Expectations-label-after-workflow-completes-2876d73d365081e29fbbe6e3127ca973) by [Unito](https://www.unito.io)
80 lines
2.9 KiB
YAML
80 lines
2.9 KiB
YAML
# Setting test expectation screenshots for Playwright
|
|
name: Update Playwright Expectations
|
|
|
|
on:
|
|
pull_request:
|
|
types: [labeled]
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
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: Initial Checkout
|
|
uses: actions/checkout@v5
|
|
- name: Pull Request Checkout (from comment)
|
|
run: gh pr checkout ${{ github.event.issue.number }}
|
|
if: github.event_name == 'issue_comment'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Pull Request Checkout (from label)
|
|
run: |
|
|
git fetch origin ${{ github.head_ref }}
|
|
git checkout ${{ github.head_ref }}
|
|
if: github.event_name == 'pull_request'
|
|
- 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
|
|
working-directory: ComfyUI_frontend
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-report
|
|
path: ComfyUI_frontend/playwright-report/
|
|
retention-days: 30
|
|
- name: Debugging info
|
|
run: |
|
|
echo "PR: ${{ github.event.issue.number }}"
|
|
git status
|
|
working-directory: ComfyUI_frontend
|
|
- 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
|
|
if git diff --cached --quiet; then
|
|
echo "No changes to commit"
|
|
else
|
|
git commit -m "[automated] Update test expectations"
|
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
git push origin HEAD:${{ github.head_ref }}
|
|
else
|
|
git push
|
|
fi
|
|
fi
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
working-directory: ComfyUI_frontend
|
|
|
|
- name: Remove New Browser Test Expectations label
|
|
if: always() && github.event_name == 'pull_request'
|
|
run: gh pr edit ${{ github.event.pull_request.number }} --remove-label "New Browser Test Expectations"
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|