From 56596ccefa1bcb7b2322dc11ae6c981313d2f7ab Mon Sep 17 00:00:00 2001
From: Giles Westwood
+```yml +name: pr + +on: + pull_request: + +jobs: + unit_test: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Build and Run Tests ( this step will create a check failure if tests fail) + run: # execute your tests generating test results + + - name: Publish Test Report as a check + # only report if a test has failed and we are a non forked repo + if: ${{ failure() && (github.event.pull_request.head.repo.full_name == github.repository) }} + uses: mikepenz/action-junit-report@v5 + + - name: Write out Unit Test report annotation for forked repo + # only report if a test has failed and we are a forked repo + if: ${{ failure() && (github.event.pull_request.head.repo.full_name != github.repository) }} + uses: mikepenz/action-junit-report@v5 + with: + annotate_only: true # forked repo cannot write to checks so just do annotations +``` +
++ ```yml name: pr @@ -277,6 +278,8 @@ jobs: with: annotate_only: true # forked repo cannot write to checks so just do annotations ``` + +This will selectively use different methods for forked and unforked repos.
@@ -261,18 +260,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Build and Run Tests ( this step will create a check failure if tests fail) + - name: Build and Run Tests run: # execute your tests generating test results - - name: Publish Test Report as a check - # only report if a test has failed and we are a non forked repo - if: ${{ failure() && (github.event.pull_request.head.repo.full_name == github.repository) }} - uses: mikepenz/action-junit-report@v5 - - name: Write out Unit Test report annotation for forked repo - # only report if a test has failed and we are a forked repo if: ${{ failure() && (github.event.pull_request.head.repo.full_name != github.repository) }} uses: mikepenz/action-junit-report@v5 with: