From d912ce450d8e6a0011b94dd4a2e1abebf62c1664 Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Fri, 3 Feb 2023 10:50:31 +0530 Subject: [PATCH] sync_approved_pr: Fix git safe directory issue - while initialising git repo in docker container --- github_pr_to_internal_pr/Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/github_pr_to_internal_pr/Dockerfile b/github_pr_to_internal_pr/Dockerfile index 422d76a..9ac679b 100644 --- a/github_pr_to_internal_pr/Dockerfile +++ b/github_pr_to_internal_pr/Dockerfile @@ -12,6 +12,18 @@ RUN apt-get update && \ pip3 install --upgrade pip && \ pip3 install -r /tmp/requirements.txt +# Changing the ownership of the repository after checking out +# Error: fatal: detected dubious ownership in repository at '/github/workspace' +# To add an exception for this directory, call: +# git config --global --add safe.directory /github/workspace +# Reason: Recent versions of git require the .git folder to be owned +# by the same user (see https://github.blog/2022-04-12-git-security-vulnerability-announced/). +# Related +# - https://github.com/actions/runner/issues/2033 +# - https://github.com/actions/checkout/issues/1048 +# - https://github.com/actions/runner-images/issues/6775 +RUN chown -R $(id -u):$(id -g) $PWD + COPY github_pr_to_internal_pr.py / ENTRYPOINT ["/usr/bin/python3", "/github_pr_to_internal_pr.py"]