Skip to content

Commit

Permalink
Fix builds on forked pull requests
Browse files Browse the repository at this point in the history
The action `dorny/test-reporter@v1` requires write permissions, which
are not available for pull requests from forked repositories.
  • Loading branch information
JojOatXGME committed May 4, 2024
1 parent 7bcb41c commit a055f88
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ jobs:
name: Gradle ${{ matrix.gradleVersion }} @ ${{ matrix.os }}
needs: gradleValidation
runs-on: ${{ matrix.os }}
permissions:
checks: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -84,14 +82,6 @@ jobs:
- name: Run Tests
run: ./gradlew check -PtestGradleVersion="${{ matrix.gradleVersion }}" ${{ runner.os == 'Windows' && '-PtestGradleUserHome="C:\\testGradleHome"' || '' }}

- name: Test Report
uses: dorny/test-reporter@v1
if: ${{ always() }}
with:
name: "Unit Tests Report: Gradle ${{ matrix.gradleVersion }} @ ${{ matrix.os }}"
path: "**/build/test-results/*/TEST-*.xml"
reporter: java-junit

- name: Collect Test Results
if: ${{ failure() }}
uses: actions/upload-artifact@v4
Expand All @@ -100,6 +90,7 @@ jobs:
path: |
${{ github.workspace }}/build/reports/tests/test/
${{ github.workspace }}/build/reports/configuration-cache
${{ github.workspace }}/build/test-results
build:
name: Build
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test Report
run-name: >
Test Report for ${{ github.event.workflow.name }}
#${{ github.event.workflow_run.run_number }}:
${{ github.event.workflow_run.display_title }}
on:
workflow_run:
workflows: [Build]
types: [completed]

jobs:
report:
name: Test Report
runs-on: ubuntu-latest

steps:

- name: Test Report
uses: dorny/test-reporter@v1
with:
artifact: /test-results-([^-]*)-(.*)/
name: "Unit Tests Report: Gradle $1 @ $2"
path: "test-results/*/TEST-*.xml"
reporter: java-junit
fail-on-empty: false

0 comments on commit a055f88

Please sign in to comment.