EndBug/add-and-commit

Error: fatal: detected dubious ownership in repository

t4k opened this issue ยท 1 comments

t4k commented

Describe the bug
Using default_author: github_actions as the docs describe with actions/checkout and I'm getting an error that includes:

> Using 'github-actions <41898282+github-actions[bot]@users.noreply.github.com>' as author.
...
Error: Error: fatal: detected dubious ownership in repository at '/__w/overtime/overtime'

(Seems like the same issue as #556)

Workflow used
I think is is enough to debug:

    steps:
      - uses: actions/checkout@v4
...
      - name: Commit Changes
        uses: EndBug/add-and-commit@v9
        with:
          remove: '--ignore-unmatch --quiet -- content/pages/*.html'
          default_author: github_actions
          message: '๐ŸŒ€ track changes to page content'

Expected behavior
Changes to be committed and github-actions[bot] to be seen as the the author.

Logs

Logs
Run EndBug/add-and-commit@v9
  with:
    remove: --ignore-unmatch --quiet -- content/pages/*.html
    default_author: github_actions
    message: ๐ŸŒ€ track changes to page content
    add: .
    cwd: .
    fetch: --tags --force
    pathspec_error_handling: ignore
    push: true
    github_token: ***
  env:
    pythonLocation: /__t/Python/3.11.6/x64
    PKG_CONFIG_PATH: /__t/Python/3.11.6/x64/lib/pkgconfig
    Python_ROOT_DIR: /__t/Python/3.11.6/x64
    Python2_ROOT_DIR: /__t/Python/3.11.6/x64
    Python3_ROOT_DIR: /__t/Python/3.11.6/x64
    LD_LIBRARY_PATH: /__t/Python/3.11.6/x64/lib
/usr/bin/docker exec  5f0196471c2f3c543649c3601f1ff454afb2132acb3fcc21e4c1d624ff7e0dc2 sh -c "cat /etc/*release | grep ^ID"
Running in /__w/overtime/overtime
Add input parsed as single string, running 1 git add command.
Remove input parsed as single string, running 1 git rm command.
> Using 'github-actions <41898282+github-actions[bot]@users.noreply.github.com>' as author.
> Using "๐ŸŒ€ track changes to page content [actions]" as commit message.
Internal logs
  > Staging files...
  > Adding files...
  Error: Error: fatal: detected dubious ownership in repository at '/__w/overtime/overtime'
  To add an exception for this directory, call:
git config --global --add safe.directory /__w/overtime/overtime

Outputs
committed: false
commit_long_sha: undefined
commit_sha: undefined
pushed: false
tagged: false
tag_pushed: false
Error: Error: fatal: detected dubious ownership in repository at '/__w/overtime/overtime'
To add an exception for this directory, call:

git config --global --add safe.directory /__w/overtime/overtime

t4k commented

I did not include my whole workflow and I am running this in a container. I had to use options: --user 1001 in the container configuration.

Figured out via actions/checkout#1048 (comment) and actions/runner#2033 (comment).