| 1 |
# Copied from https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.23/README.md#support-fork-repositories-and-dependabot-branches |
| 2 |
# Warning: changes to this workflow will NOT be picked up until they land in the main branch! |
| 3 |
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run |
| 4 |
|
| 5 |
name: Publish test results |
| 6 |
|
| 7 |
on: |
| 8 |
workflow_run: |
| 9 |
workflows: [Tests] |
| 10 |
types: [completed] |
| 11 |
|
| 12 |
jobs: |
| 13 |
publish-test-results: |
| 14 |
name: Publish test results |
| 15 |
runs-on: ubuntu-latest |
| 16 |
if: github.event.workflow_run.conclusion != 'skipped' |
| 17 |
|
| 18 |
# Needed to post comments on the PR |
| 19 |
permissions: |
| 20 |
checks: write |
| 21 |
pull-requests: write |
| 22 |
|
| 23 |
steps: |
| 24 |
- name: Download and extract artifacts |
| 25 |
env: |
| 26 |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 27 |
run: | |
| 28 |
mkdir artifacts && cd artifacts |
| 29 |
|
| 30 |
artifacts_url=${{ github.event.workflow_run.artifacts_url }} |
| 31 |
|
| 32 |
gh api --paginate "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact |
| 33 |
do |
| 34 |
IFS=$'\t' read name url <<< "$artifact" |
| 35 |
gh api $url > "$name.zip" |
| 36 |
unzip -d "$name" "$name.zip" |
| 37 |
done |
| 38 |
|
| 39 |
- name: Publish Unit Test Results |
| 40 |
uses: EnricoMi/publish-unit-test-result-action@v2 |
| 41 |
with: |
| 42 |
check_name: Unit Test Results |
| 43 |
comment_title: | |
| 44 |
Unit Test Results |
| 45 |
_See [test report](https://dask.github.io/dask/test_report.html) for an extended history of previous test failures. This is useful for diagnosing flaky tests._ |
| 46 |
commit: ${{ github.event.workflow_run.head_sha }} |
| 47 |
event_file: artifacts/Event File/event.json |
| 48 |
event_name: ${{ github.event.workflow_run.event }} |
| 49 |
junit_files: artifacts/**/*.xml |
| 50 |
fail_on: "errors" |