Skip to content

Commit

Permalink
Add repository path to Git safe.directory
Browse files Browse the repository at this point in the history
Required because the owner inside containers is different, likely root,
and git doesn't allow that by default.
  • Loading branch information
Flamefire committed Feb 28, 2025
1 parent 0911380 commit 3f7d309
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ci/github/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright 2021 Alexander Grund
# Copyright 2021-2025 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -13,6 +13,10 @@

set -ex

# Required because inside a container the owner is root so git commands would fail.
# Note that $GITHUB_WORKSPACE != ${{github.workspace}} (in the CI yml) inside containers.
git config --global --add safe.directory "$GITHUB_WORKSPACE" || echo "Failed to set Git safe.directory" # Don't fail, just warn

BOOST_CI_TARGET_BRANCH="${GITHUB_BASE_REF:-$GITHUB_REF}"
export BOOST_CI_TARGET_BRANCH="${BOOST_CI_TARGET_BRANCH##*/}" # Extract branch name
export BOOST_CI_SRC_FOLDER="${GITHUB_WORKSPACE//\\//}"
Expand Down Expand Up @@ -64,4 +68,4 @@ fi
[ -z "$B2_TARGETS" ] || echo "B2_TARGETS=$B2_TARGETS"
# Filter out (only) the conditions from set -x
# Write the stdout to the GitHub env file
} 2> >(grep -vF ' -z ' >&2) >> "$GITHUB_ENV"
} 2> >(grep -vF ' -z ' >&2) >> "$GITHUB_ENV"

0 comments on commit 3f7d309

Please sign in to comment.