Skip to content

Commit 81029d8

Browse files
committed
Set default git identity inside Docker runner
Configure a global git user.name and user.email in the local Docker entrypoint when they are missing. This makes local container runs behave more like GitHub CI for tests that create commits, while still allowing overrides via existing git config or UNITTESTING_GIT_USER_NAME/UNITTESTING_GIT_USER_EMAIL.
1 parent b98141c commit 81029d8

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

docker/entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ set -e
77
PATH="$HOME/.local/bin:$PATH"
88
BOOTSTRAP_MARKER="$HOME/.cache/unittesting/bootstrap.done"
99

10+
ensure_git_identity() {
11+
# Align local container behavior with typical CI runners where git
12+
# identity is configured for tests that create commits.
13+
if ! git config --global user.name >/dev/null 2>&1; then
14+
git config --global user.name "${UNITTESTING_GIT_USER_NAME:-UnitTesting CI}"
15+
fi
16+
17+
if ! git config --global user.email >/dev/null 2>&1; then
18+
git config --global user.email "${UNITTESTING_GIT_USER_EMAIL:-unittesting@example.invalid}"
19+
fi
20+
}
21+
1022
sudo sh -e /etc/init.d/xvfb start
23+
ensure_git_identity
1124

1225
UNITTESTING_SOURCE=${UNITTESTING_SOURCE:-/unittesting}
1326
SUBLIME_TEXT_VERSION=${SUBLIME_TEXT_VERSION:-4}

0 commit comments

Comments
 (0)