Skip to content

Commit fc1d040

Browse files
authored
Devex: Add additional trigger for Playwright updates (#5960)
## Summary Allow for secondary trigger for updating screenshots: > Adding a comment starting with `/update-playwright` ## Review Focus - Is this the command you'd expect? - Should I also add `/playwright-update`? ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5960-Devex-Add-additional-trigger-for-Playwright-updates-2856d73d365081768f70d0a8aafa9c11) by [Unito](https://www.unito.io)
1 parent 8fc5464 commit fc1d040

File tree

1 file changed

+50
-34
lines changed

1 file changed

+50
-34
lines changed

.github/workflows/update-playwright-expectations.yaml

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,58 @@ name: Update Playwright Expectations
33

44
on:
55
pull_request:
6-
types: [ labeled ]
6+
types: [labeled]
7+
issue_comment:
8+
types: [created]
79

810
jobs:
911
test:
1012
runs-on: ubuntu-latest
11-
if: github.event.label.name == 'New Browser Test Expectations'
13+
if: >
14+
( github.event_name == 'pull_request' && github.event.label.name == 'New Browser Test Expectations' ) ||
15+
( github.event.issue.pull_request &&
16+
github.event_name == 'issue_comment' &&
17+
(
18+
github.event.comment.author_association == 'OWNER' ||
19+
github.event.comment.author_association == 'MEMBER' ||
20+
github.event.comment.author_association == 'COLLABORATOR'
21+
) &&
22+
startsWith(github.event.comment.body, '/update-playwright') )
1223
steps:
13-
- name: Checkout workflow repo
14-
uses: actions/checkout@v5
15-
- name: Setup Frontend
16-
uses: ./.github/actions/setup-frontend
17-
- name: Setup Playwright
18-
uses: ./.github/actions/setup-playwright
19-
- name: Run Playwright tests and update snapshots
20-
id: playwright-tests
21-
run: pnpm exec playwright test --update-snapshots
22-
continue-on-error: true
23-
working-directory: ComfyUI_frontend
24-
- uses: actions/upload-artifact@v4
25-
if: always()
26-
with:
27-
name: playwright-report
28-
path: ComfyUI_frontend/playwright-report/
29-
retention-days: 30
30-
- name: Debugging info
31-
run: |
32-
echo "Branch: ${{ github.head_ref }}"
33-
git status
34-
working-directory: ComfyUI_frontend
35-
- name: Commit updated expectations
36-
run: |
37-
git config --global user.name 'github-actions'
38-
git config --global user.email '[email protected]'
39-
git fetch origin ${{ github.head_ref }}
40-
git checkout -B ${{ github.head_ref }} origin/${{ github.head_ref }}
41-
git add browser_tests
42-
git commit -m "[automated] Update test expectations"
43-
git push origin HEAD:${{ github.head_ref }}
44-
working-directory: ComfyUI_frontend
24+
- name: Initial Checkout
25+
uses: actions/checkout@v5
26+
- name: Pull Request Checkout
27+
run: gh pr checkout ${{ github.event.issue.number }}
28+
if: github.event.issue.pull_request && github.event_name == 'issue_comment'
29+
env:
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- name: Setup Frontend
32+
uses: ./.github/actions/setup-frontend
33+
- name: Setup Playwright
34+
uses: ./.github/actions/setup-playwright
35+
- name: Run Playwright tests and update snapshots
36+
id: playwright-tests
37+
run: pnpm exec playwright test --update-snapshots
38+
continue-on-error: true
39+
working-directory: ComfyUI_frontend
40+
- uses: actions/upload-artifact@v4
41+
if: always()
42+
with:
43+
name: playwright-report
44+
path: ComfyUI_frontend/playwright-report/
45+
retention-days: 30
46+
- name: Debugging info
47+
run: |
48+
echo "PR: ${{ github.event.issue.number }}"
49+
git status
50+
working-directory: ComfyUI_frontend
51+
- name: Commit updated expectations
52+
run: |
53+
git config --global user.name 'github-actions'
54+
git config --global user.email '[email protected]'
55+
git add browser_tests
56+
git diff --cached --quiet || git commit -m "[automated] Update test expectations"
57+
git push
58+
env:
59+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
working-directory: ComfyUI_frontend

0 commit comments

Comments
 (0)