From 56596ccefa1bcb7b2322dc11ae6c981313d2f7ab Mon Sep 17 00:00:00 2001 From: Giles Westwood Date: Wed, 6 Nov 2024 12:07:30 +0000 Subject: [PATCH 1/3] docs: small example to show a use case for annotate_only --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index 2906ec2e..e80569e0 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,44 @@ This will securely post the check results from the privileged workflow onto the

+Another way to have this action be useful when permissions do not allow for checks: write +is to just leverage the annotate\_only option. + +
Example +

+```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 +``` +

+
+ + + ## Sample 🖥️
From 46ad281d0ae77348f5726f4f1d9df569a2eb7226 Mon Sep 17 00:00:00 2001 From: Giles Westwood Date: Wed, 6 Nov 2024 12:10:52 +0000 Subject: [PATCH 2/3] docs: try to fix yaml rendering --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e80569e0..26534f35 100644 --- a/README.md +++ b/README.md @@ -249,6 +249,7 @@ is to just leverage the annotate\_only option.
Example

+ ```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.

From eb88208e11e588055570220888bdc6b030e7d96a Mon Sep 17 00:00:00 2001 From: Mike Penz Date: Sat, 16 Nov 2024 17:32:28 +0100 Subject: [PATCH 3/3] - slightly rephrase updated README --- README.md | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 26534f35..126006ca 100644 --- a/README.md +++ b/README.md @@ -244,8 +244,7 @@ This will securely post the check results from the privileged workflow onto the

-Another way to have this action be useful when permissions do not allow for checks: write -is to just leverage the annotate\_only option. +In environments that do not allow `checks: write`, the action can be configured to leverage the annotate\_only option.
Example

@@ -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: