From b6b64551891060fb4e47d54d3e71df0b4f166ab5 Mon Sep 17 00:00:00 2001 From: Alexander Brown Date: Thu, 9 Oct 2025 11:32:38 -0700 Subject: [PATCH] CI: Simplify update playwright expectations (maybe) (#5994) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Follow-up to https://github.com/Comfy-Org/ComfyUI_frontend/pull/5985 See if it's possible to reduce the branching, maybe add reactions and a Done comment? ## Changes - **What**: Snapshot Update Updates ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5994-CI-Simplify-update-playwright-expectations-maybe-2876d73d365081eab031d8301c1360b7) by [Unito](https://www.unito.io) --- .../update-playwright-expectations.yaml | 59 +++++++++++++------ 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/.github/workflows/update-playwright-expectations.yaml b/.github/workflows/update-playwright-expectations.yaml index 73ff7c377..88ff9833a 100644 --- a/.github/workflows/update-playwright-expectations.yaml +++ b/.github/workflows/update-playwright-expectations.yaml @@ -7,6 +7,9 @@ on: issue_comment: types: [created] +concurrency: + group: ${{ github.event.number || github.event.issue.number }} + jobs: test: runs-on: ubuntu-latest @@ -21,18 +24,36 @@ jobs: ) && startsWith(github.event.comment.body, '/update-playwright') ) steps: + - name: Find Update Comment + uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad + id: "find-update-comment" + with: + issue-number: ${{ github.event.number || github.event.issue.number }} + comment-author: "github-actions[bot]" + body-includes: "Updating Playwright Expectations" + + - name: Add Starting Reaction + uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 + with: + comment-id: ${{ steps.find-update-comment.outputs.comment-id }} + issue-number: ${{ github.event.number || github.event.issue.number }} + body: | + Updating Playwright Expectations + edit-mode: replace + reactions: eyes + + - name: Get Branch SHA + id: "get-branch" + run: echo ::set-output name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName') + env: + REPO: ${{ github.repository }} + PR_NO: ${{ github.event.number || github.event.issue.number }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - 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' + with: + ref: ${{ steps.get-branch.outputs.branch }} - name: Setup Frontend uses: ./.github/actions/setup-frontend - name: Setup Playwright @@ -51,6 +72,7 @@ jobs: - name: Debugging info run: | echo "PR: ${{ github.event.issue.number }}" + echo "Branch: ${{ steps.get-branch.outputs.branch }}" git status working-directory: ComfyUI_frontend - name: Commit updated expectations @@ -62,16 +84,19 @@ jobs: 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 + git push origin ${{ steps.get-branch.outputs.branch }} fi - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} working-directory: ComfyUI_frontend + - name: Add Done Reaction + uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 + if: github.event_name == 'issue_comment' + with: + comment-id: ${{ steps.find-update-comment.outputs.comment-id }} + issue-number: ${{ github.event.number || github.event.issue.number }} + reactions: +1 + reactions-edit-mode: replace + - 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"