diff --git a/.github/workflows/pr_ci_playwright_e2e.yaml b/.github/workflows/pr_ci_playwright_e2e.yaml index 60c2a1eef..e388ba5b7 100644 --- a/.github/workflows/pr_ci_playwright_e2e.yaml +++ b/.github/workflows/pr_ci_playwright_e2e.yaml @@ -62,6 +62,51 @@ jobs: run: | sudo yarn playwright test --reporter=html + - name: Ensure gh-pages branch exists + run: | + git fetch + if ! git show-ref --verify --quiet refs/heads/gh-pages; then + echo "gh-pages branch does not exist. Creating..." + git checkout --orphan gh-pages + git rm -rf . + echo "# GitHub Pages" > index.html + git add index.html + git commit -m "Initial commit" + git push origin gh-pages + fi + + - name: Ensure gh-pages branch exists + run: | + git fetch origin gh-pages + if git rev-parse --verify origin/gh-pages; then + git checkout gh-pages + git reset --hard origin/gh-pages + else + git checkout --orphan gh-pages + git rm -rf . + echo "# GitHub Pages" > index.html + git add index.html + git -c user.name='github-actions[bot]' -c user.email='github-actions[bot]@users.noreply.github.com' commit -m "Initial commit" + git push origin gh-pages + fi + + - name: Deploy Playwright Report to gh-pages + if: always() + run: | + # Configuring git + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + # Clone the repository to the gh-pages branch + git clone --branch=gh-pages https://github.com/${{ github.repository }} gh-pages || (git clone https://github.com/${{ github.repository }} gh-pages && cd gh-pages && git checkout --orphan gh-pages) + cd gh-pages + # Copying the Playwright report to the gh-pages branch + rm -rf ./* + cp -r ../frontend/playwright-report/* . + # Committing and pushing the changes + git add . + git -c user.name='github-actions[bot]' -c user.email='github-actions[bot]@users.noreply.github.com' commit -m "Update Playwright report" + git push origin gh-pages --force + - name: Upload Playwright report if: always() uses: actions/upload-artifact@v4