Skip to content
70 changes: 69 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ permissions:
checks: write
pull-requests: write
contents: write
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -153,8 +155,72 @@ jobs:
path: playwright-report
retention-days: 2

publish-report:
if: ${{ !cancelled() && github.event_name != 'pull_request' }}
needs: [merge-reports]
runs-on: ubuntu-latest
outputs:
page_url: ${{ steps.set-url.outputs.page_url }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Download HTML report
uses: actions/download-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
- name: Determine report destination
id: report-dest
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
DEST_DIR="${{ github.event.pull_request.number }}"
else
DEST_DIR="${{ github.run_id }}"
fi
echo "destination=$DEST_DIR" >> "$GITHUB_OUTPUT"
echo "Report will be published to: $DEST_DIR"
- name: Prepare report for Pages
run: |
mkdir -p pages-artifact/${{ steps.report-dest.outputs.destination }}
cp -r playwright-report/* pages-artifact/${{ steps.report-dest.outputs.destination }}/
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./pages-artifact
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Set page URL
id: set-url
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
REPORT_PATH="${{ github.event.pull_request.number }}"
else
REPORT_PATH="${{ github.run_id }}"
fi
PAGE_URL="https://jumperexchange.github.io/jumper-exchange/${REPORT_PATH}/"
echo "page_url=$PAGE_URL" >> "$GITHUB_OUTPUT"
echo "Report URL: $PAGE_URL"
- name: Add report link to summary
if: always()
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
REPORT_PATH="${{ github.event.pull_request.number }}"
else
REPORT_PATH="${{ github.run_id }}"
fi
PAGES_URL="https://jumperexchange.github.io/jumper-exchange/${REPORT_PATH}/"
echo "## 📊 Playwright Test Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 **[View Report](${PAGES_URL})**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
Comment on lines +208 to +220
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

always() may add broken links if deployment fails.

Using if: always() means this step runs even when Deploy to GitHub Pages fails, potentially adding a broken link to the summary. Consider conditioning on deployment success:

🔧 Suggested fix
       - name: Add report link to summary
-        if: always()
+        if: ${{ steps.deployment.outcome == 'success' }}
         run: |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Add report link to summary
if: always()
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
REPORT_PATH="${{ github.event.pull_request.number }}"
else
REPORT_PATH="${{ github.run_id }}"
fi
# Extract repo name from github.repository (format: owner/repo)
REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
PAGES_URL="https://${{ github.repository_owner }}.github.io/${REPO_NAME}/${REPORT_PATH}/"
echo "## 📊 Playwright Test Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 **[View Report](${PAGES_URL})**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
- name: Add report link to summary
if: ${{ steps.deployment.outcome == 'success' }}
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
REPORT_PATH="${{ github.event.pull_request.number }}"
else
REPORT_PATH="${{ github.run_id }}"
fi
# Extract repo name from github.repository (format: owner/repo)
REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
PAGES_URL="https://${{ github.repository_owner }}.github.io/${REPO_NAME}/${REPORT_PATH}/"
echo "## 📊 Playwright Test Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔗 **[View Report](${PAGES_URL})**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
🤖 Prompt for AI Agents
In @.github/workflows/playwright.yml around lines 210 - 224, The step named "Add
report link to summary" currently uses if: always(), which can add a broken
Pages link when the "Deploy to GitHub Pages" step fails; change the condition to
only run after a successful deployment (e.g., use if: success() or guard with
the specific step/job outcome) so the PAGES_URL echoing logic only executes when
the deploy step (named "Deploy to GitHub Pages") succeeded and the
REPORT_PATH/GITHUB_PAGES URL is valid; keep the REPORT_PATH and PAGES_URL
construction but gate the step on deploy success.


post-comment:
needs: [create-qase-run, merge-reports]
needs: [create-qase-run, merge-reports, publish-report]
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
Comment on lines 222 to 224
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Post-comment will be skipped on PRs due to skipped dependency.

publish-report is gated to non‑PR events, but post-comment needs it. On PRs, publish-report is skipped and GitHub Actions will skip post-comment, so no PR comment is posted.

🔧 Suggested fix (remove unnecessary dependency)
  post-comment:
-   needs: [create-qase-run, merge-reports, publish-report]
+   needs: [create-qase-run, merge-reports]
    if: ${{ !cancelled() && github.event_name == 'pull_request' }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
post-comment:
needs: [create-qase-run, merge-reports]
needs: [create-qase-run, merge-reports, publish-report]
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
post-comment:
needs: [create-qase-run, merge-reports]
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
🤖 Prompt for AI Agents
In @.github/workflows/playwright.yml around lines 222 - 224, The post-comment
job is being skipped on PRs because it lists publish-report in its needs but
publish-report is intentionally gated to non‑PR events and thus skipped; update
the post-comment job (post-comment) to remove publish-report from its needs
array (keep create-qase-run and merge-reports) so post-comment can run on PRs,
or alternatively change publish-report's gating if post-comment must depend on
it.

runs-on: ubuntu-latest
steps:
Expand All @@ -164,3 +230,5 @@ jobs:
${{ needs.merge-reports.outputs.summary }}

${{ needs.create-qase-run.outputs.public_link != '' && needs.create-qase-run.outputs.public_link != null && format('📋 [View Detailed Qase Report]({0})', needs.create-qase-run.outputs.public_link) || '' }}

📊 [Download HTML Test Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - Available in the workflow artifacts
Loading