Skip to content

Publish Test Results #576

Publish Test Results

Publish Test Results #576

name: Publish Test Results
on:
workflow_run:
workflows: ["Receive Pull Request"]
types:
- completed
jobs:
publish-test-results:
name: Publish Test Results
runs-on: ubuntu-latest
# the build-and-test job might be skipped, we don't need to run this job then
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
( github.event.workflow_run.conclusion == 'success' ||
github.event.workflow_run.conclusion == 'failure' ) }}
steps:
- name: 'Download artifact'
uses: actions/[email protected]
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "unit-test-results"
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/unit-test-results.zip', Buffer.from(download.data));
- run: unzip unit-test-results.zip
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
check_name: Unit Test Results
github_token: ${{ secrets.GITHUB_TOKEN }}
commit: ${{ github.event.workflow_run.head_sha }}
trx_files: "**/*.trx"
report_individual_runs: true
check_run_annotations: all tests, skipped tests