Skip to content

Commit 6141c38

Browse files
authored
Merge pull request #1231 from gilesw/docs/example-stanza-for-forked-non-forked-usecase
Docs/example stanza for forked non forked usecase
2 parents 511b061 + eb88208 commit 6141c38

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,40 @@ This will securely post the check results from the privileged workflow onto the
244244
</p>
245245
</details>
246246

247+
In environments that do not allow `checks: write`, the action can be configured to leverage the annotate\_only option.
248+
249+
<details><summary><b>Example</b></summary>
250+
<p>
251+
252+
```yml
253+
name: pr
254+
255+
on:
256+
pull_request:
257+
258+
jobs:
259+
unit_test:
260+
runs-on: ubuntu-latest
261+
steps:
262+
- name: Checkout Code
263+
uses: actions/checkout@v4
264+
265+
- name: Build and Run Tests
266+
run: # execute your tests generating test results
267+
268+
- name: Write out Unit Test report annotation for forked repo
269+
if: ${{ failure() && (github.event.pull_request.head.repo.full_name != github.repository) }}
270+
uses: mikepenz/action-junit-report@v5
271+
with:
272+
annotate_only: true # forked repo cannot write to checks so just do annotations
273+
```
274+
275+
This will selectively use different methods for forked and unforked repos.
276+
</p>
277+
</details>
278+
279+
280+
247281
## Sample 🖥️
248282

249283
<div align="center">

0 commit comments

Comments
 (0)