1name: Publish CoreValidation Results
2
3on:
4  workflow_run:
5    workflows: ["CoreValidation"]
6    # avoid running once merged on main branch, this should be run only on PRs
7    branches-ignore: ["main"]
8    types:
9      - completed
10
11jobs:
12  publish-test-results:
13    name: Publish Test Results
14    runs-on: ubuntu-22.04
15    if: github.event.workflow_run.conclusion != 'skipped'
16
17    steps:
18      - name: Download and Extract Artifacts
19        env:
20          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
21        run: |
22           mkdir -p artifacts && cd artifacts
23
24           artifacts_url=${{ github.event.workflow_run.artifacts_url }}
25
26           gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
27           do
28             IFS=$'\t' read name url <<< "$artifact"
29             gh api $url > "$name.zip"
30             unzip -d "$name" "$name.zip"
31           done
32
33      - name: Publish Test Results
34        uses: EnricoMi/publish-unit-test-result-action@v2
35        with:
36          commit: ${{ github.event.workflow_run.head_sha }}
37          event_file: artifacts/EventFile/event.json
38          report_individual_runs: true
39          event_name: ${{ github.event.workflow_run.event }}
40          files: "artifacts/**/*.junit"
41