Skip to content

Commit

Permalink
2nd attempt to show test results of PRs from fork repositories
Browse files Browse the repository at this point in the history
Integrate the unit-test job into the build job, so that the PR is
accessible.
  • Loading branch information
ptziegler committed Sep 12, 2024
1 parent cf30d13 commit 9337ff5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 41 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,31 @@ jobs:
if-no-files-found: error
path: |
${{ github.workspace }}/**/target/surefire-reports/*.xml

unit-test-results:
name: Unit Test Results
needs: build
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'
permissions:
checks: write
pull-requests: write

steps:
- name: Download and Extract Artifacts
run: |
mkdir -p artifacts && cd artifacts

artifacts_url=${{ github.event.workflow_run.artifacts_url }}

gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
done

- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@82082dac68ad6a19d980f8ce817e108b9f496c2a
with:
files: "artifacts/**/*.xml"
41 changes: 0 additions & 41 deletions .github/workflows/unit-tests.yml

This file was deleted.

0 comments on commit 9337ff5

Please sign in to comment.