chore: publish markdown report as a comment (#23825)

This commit is contained in:
Yury Semikhatsky 2023-07-11 14:27:58 -07:00 committed by GitHub
parent 700a925565
commit 8fbcffa43e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,9 +44,9 @@ jobs:
output_dir: 'blob-report' output_dir: 'blob-report'
connection_string: '${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}' connection_string: '${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}'
- name: Merge into HTML Report - name: Merge reports
run: | run: |
npx playwright merge-reports --reporter html --attachments missing blob-report npx playwright merge-reports --reporter markdown,html --attachments missing blob-report
- name: Upload HTML report to Azure - name: Upload HTML report to Azure
run: | run: |
@ -92,10 +92,16 @@ jobs:
const reportDir = 'run-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-${{ github.sha }}'; const reportDir = 'run-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-${{ github.sha }}';
const reportUrl = `https://mspwblobreport.z1.web.core.windows.net/${reportDir}/index.html`; const reportUrl = `https://mspwblobreport.z1.web.core.windows.net/${reportDir}/index.html`;
core.notice('Report url: ' + reportUrl); core.notice('Report url: ' + reportUrl);
const reportMd = await fs.promises.readFile('report.md', 'utf8');
const { data: response } = await github.rest.issues.createComment({ const { data: response } = await github.rest.issues.createComment({
...context.repo, ...context.repo,
issue_number: prNumber, issue_number: prNumber,
body: `"${{ github.event.workflow_run.name }}" [report](${reportUrl}).`, body: [
`### Test results for "${{ github.event.workflow_run.name }}"`,
reportMd,
'---',
`Full [html report](${reportUrl}).`
].join('\n'),
}); });
core.info('Posted comment: ' + response.html_url); core.info('Posted comment: ' + response.html_url);
@ -108,7 +114,11 @@ jobs:
conclusion: 'success', conclusion: 'success',
details_url: reportUrl, details_url: reportUrl,
output: { output: {
title: 'Merged test results (${{ github.event.workflow_run.name }})', title: 'Test results for "${{ github.event.workflow_run.name }}"',
summary: `Created [report](${reportUrl}). Merge [workflow run](${mergeWorkflowUrl}).`, summary: [
reportMd,
'---',
`Full [html report](${reportUrl}). Merge [workflow run](${mergeWorkflowUrl}).`
].join('\n'),
} }
}); });