Skip to content

Commit

Permalink
Fix git error in container
Browse files Browse the repository at this point in the history
Otherwise we see the following when running in a container:

  fatal: detected dubious ownership in repository at '/github/workspace'
  To add an exception for this directory, call:
  • Loading branch information
tgorochowik authored Mar 22, 2023
1 parent 9c4778d commit cc6054c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
event_file=event.json
diff_cmd="git diff FECH_HEAD"

# XXX: workaround for "fatal: detected dubious ownership in repository" when running in a container
git config --global --add safe.directory '*'

if [ -f "$event_file" ]; then
pr_branch=$(python3 -c "import sys, json; print(json.load(sys.stdin)['pull_request']['head']['ref'])" < event.json)
base_branch=$(python3 -c "import sys, json; print(json.load(sys.stdin)['pull_request']['base']['ref'])" < event.json)
Expand Down

0 comments on commit cc6054c

Please sign in to comment.