From cc6054cacf4f99e7ab2f5292d2c674695c5948a9 Mon Sep 17 00:00:00 2001 From: Tomasz Gorochowik Date: Wed, 22 Mar 2023 09:37:49 +0100 Subject: [PATCH 1/2] Fix git error in container 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: --- entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 40d3a83..1ad1e37 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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) From 2049f5f8f14562493f7f47ac9a2ea64b745d347c Mon Sep 17 00:00:00 2001 From: Tomasz Gorochowik Date: Wed, 22 Mar 2023 09:40:26 +0100 Subject: [PATCH 2/2] Exit early if needed Otherwise we might miss other errors in the CI here --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 1ad1e37..c4e8834 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -x + event_file=event.json diff_cmd="git diff FECH_HEAD"