Skip to content

Commit 8cbbcff

Browse files
committed
doc: Add workaround for ownership on self-hosted runners
Relate-to: #1048 (comment) Signed-off-by: Philippe Coval <rzr@users.sf.net>
1 parent 85e6279 commit 8cbbcff

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Diff for: README.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,31 @@ jobs:
314314

315315
*NOTE:* The user email is `{user.id}+{user.login}@users.noreply.github.com`. See users API: https://api.github.com/users/github-actions%5Bbot%5D
316316

317+
## Post checkout permission check
318+
319+
```yaml
320+
on: push
321+
jobs:
322+
build:
323+
runs-on: ubuntu-latest
324+
steps:
325+
- uses: actions/checkout@v4
326+
run: >-
327+
set -x
328+
&& echo "# workaround: https://github.com/actions/checkout/issues/1048#issuecomment-2768908874"
329+
&& git status
330+
|| git config --system --add safe.directory "${PWD}"
331+
```
332+
333+
This check prevent/workaround "fatal: detected dubious ownership in repository" error on self hosted runners.
334+
317335
# Recommended permissions
318336

319337
When using the `checkout` action in your GitHub Actions workflow, it is recommended to set the following `GITHUB_TOKEN` permissions to ensure proper functionality, unless alternative auth is provided via the `token` or `ssh-key` inputs:
320338

321339
```yaml
322340
permissions:
323-
contents: read
341+
contents: read
324342
```
325343

326344
# License

0 commit comments

Comments
 (0)