Skip to content

Commit

Permalink
Add `/github/workspace/ to git safe.directory (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA authored Apr 14, 2022
1 parent d840624 commit 7eb6734
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ elif [ -z "${INPUT_BRANCH}" ]; then
INPUT_BRANCH=main
fi

# Due to multi-user vulnerabilities (between Docker user and host user), we need to add a safe directory
# In a GitHub Action, the Actions workspace from the host is mounted at `/github/workspace` within the container.
# This path should also be the current working directory, however, to be sure the current working directory is
# added to the safe.directory configuration as well. If it's the same, it shouldn't matter.
git config --global --add safe.directory /github/workspace
git config --global --add safe.directory ${PWD}

# Retrieve target repository
echo -e "\nFetching the latest information from '${GITHUB_REPOSITORY}' ..."
git config --local --name-only --get-regexp "http\.https\:\/\/github\.com\/\.extraheader" && git config --local --unset-all "http.https://github.com/.extraheader" || :
Expand Down

0 comments on commit 7eb6734

Please sign in to comment.