Deploy Playwright Report #228
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Playwright Report | |
| on: | |
| workflow_run: | |
| workflows: [Quality Checks] | |
| types: [completed] | |
| jobs: | |
| deploy_report: | |
| name: Deploy Test Report | |
| if: >- | |
| github.event.workflow_run.conclusion != 'cancelled' && | |
| ((github.event.workflow_run.event == 'push' && | |
| github.event.workflow_run.head_branch == 'main') || | |
| (github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.head_repository.full_name == github.repository && | |
| github.event.workflow_run.pull_requests[0] != null)) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: write | |
| pages: write | |
| concurrency: | |
| group: deploy_report | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch gh-pages branch | |
| run: | | |
| git fetch origin gh-pages:gh-pages | |
| mkdir gh-pages | |
| git --work-tree=gh-pages checkout gh-pages -- . | |
| - name: Download Playwright artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: playwright-artifacts | |
| path: playwright-artifacts | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| - name: Copy new report | |
| run: | | |
| if [ "${{ github.event.workflow_run.event }}" = "pull_request" ]; then | |
| REPORT_DIR="${{ github.event.workflow_run.pull_requests[0].number }}" | |
| else | |
| REPORT_DIR="main" | |
| fi | |
| rm -rf "gh-pages/$REPORT_DIR" | |
| mkdir -p "gh-pages/$REPORT_DIR" | |
| cp -r playwright-artifacts/playwright-report/. "gh-pages/$REPORT_DIR/" | |
| if [ -f "playwright-artifacts/test-results.json" ]; then | |
| cp playwright-artifacts/test-results.json "gh-pages/$REPORT_DIR/" | |
| fi | |
| - name: Deploy report to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: gh-pages | |
| destination_dir: . | |
| force_orphan: true |