Skip to content

E2E Tests Report

E2E Tests Report #108

name: E2E Tests Report
on:
workflow_run:
workflows: ['E2E Tests']
types:
- completed
jobs:
publish_report:
name: Publish E2E Report
if: >
github.event.workflow_run.event == 'pull_request' &&
(github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure')
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
pull-requests: write
steps:
- name: Checkout GitHub Pages Branch
uses: actions/checkout@v2
with:
ref: gh-pages
- name: Set Git User
# see: https://github.com/actions/checkout/issues/13#issuecomment-724415212
run: |
git config user.email "" && git config user.name "GitHub Report"
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v6
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
- name: Extract env from workflow
run: |
echo "HTML_REPORT_URL_PATH=$(cat playwright-report/report-link)" >> "$GITHUB_ENV"
echo "REPORT_PR_NUMBER=$(cat playwright-report/report-pr)" >> "$GITHUB_ENV"
- name: Move report to commit folder
run: mkdir -p ${{ env.HTML_REPORT_URL_PATH }} && mv playwright-report/report ${{ env.HTML_REPORT_URL_PATH }}/report
- name: Push HTML Report
timeout-minutes: 3
# commit report, then try push-rebase-loop until it's able to merge the HTML report to the gh-pages branch
# this is necessary when this job is running at least twice at the same time (e.g. through two pushes at the same time)
run: |
git add .
git commit -m "workflow: add HTML report for ${{ env.HTML_REPORT_URL_PATH }}"
while true; do
git pull --rebase
if [ $? -ne 0 ]; then
echo "Failed to rebase. Please review manually."
exit 1
fi
git push
if [ $? -eq 0 ]; then
echo "Successfully pushed HTML report to repo."
exit 0
fi
done
- name: Output Report URL as Workflow Annotation
run: |
FULL_HTML_REPORT_URL=https://datalens-tech.github.io/datalens/${{ env.HTML_REPORT_URL_PATH }}/report
echo "::notice title=📋 Published Playwright Test Report::$FULL_HTML_REPORT_URL"
- name: Create Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: e2e-report
number: ${{ env.REPORT_PR_NUMBER }}
message: '[E2E Report](https://datalens-tech.github.io/datalens/${{ env.HTML_REPORT_URL_PATH }}/report) is ready.'