From ba55b208a8b6b7af57ee5a9be64c246ca2cf4e02 Mon Sep 17 00:00:00 2001 From: Sung-Hyun Kang Date: Sat, 2 May 2026 15:57:06 -0500 Subject: [PATCH] Pr comment test --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5df059c82..e2d69b2af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -314,6 +314,10 @@ jobs: needs: [playwright-tests] runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + pull-requests: write steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -358,3 +362,22 @@ jobs: --account-name ${{ secrets.PREVIEW_STORAGE_ACCOUNT_NAME }} \ --auth-mode login --overwrite true echo "๐Ÿ“Š [Open Playwright report](${BASE}/playwright-reports/${KEY}/index.html)" >> $GITHUB_STEP_SUMMARY + + - name: Comment Playwright results on PR + if: ${{ !cancelled() && github.event_name == 'pull_request' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR: ${{ github.event.pull_request.number }} + REPORT_URL: https://dataexplorerpreview.z5.web.core.windows.net/playwright-reports/${{ github.run_id }}-${{ github.run_attempt }}/index.html + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + PLAYWRIGHT_JSON_OUTPUT_NAME=results.json npx playwright merge-reports --reporter json ./all-blob-reports + read PASSED FAILED FLAKY SKIPPED DURATION < <(jq -r '[.stats.expected,.stats.unexpected,.stats.flaky,.stats.skipped,(.stats.duration/1000|floor)] | @tsv' results.json) + [ "$FAILED" -gt 0 ] && ICON="โŒ failed" || ICON="โœ… passed" + gh pr comment "$PR" --body "### Playwright tests $ICON + + | Passed | Failed | Flaky | Skipped | Duration | + | :---: | :---: | :---: | :---: | :---: | + | $PASSED | $FAILED | $FLAKY | $SKIPPED | ${DURATION}s | + + ๐Ÿ“Š [Open full report]($REPORT_URL) ยท [Workflow run]($RUN_URL)"