fix(agents): safe.directory et git -C pour éviter Not a git repository

This commit is contained in:
Debian 2025-08-28 13:59:34 +00:00
parent 948b11793a
commit 99e1e0bda7
3 changed files with 6 additions and 2 deletions

View File

@ -12,6 +12,10 @@ MODE="${RUNNER_MODE:-agents}"
TARGET_DIR="${TARGET_DIR:-/work}"
OUTPUT_DIR="${OUTPUT_DIR:-/work/tests/reports/agents}"
# Rendre le dépôt monté sûr pour Git (propriétaire différent dans le conteneur)
git config --global --add safe.directory "/work" || true
git config --global --add safe.directory "${TARGET_DIR}" || true
normalize_scripts() {
if command -v dos2unix >/dev/null 2>&1; then
find /work/scripts -type f -name "*.sh" -print0 | xargs -0 -r dos2unix -f || true

View File

@ -6,7 +6,7 @@ export SCOPE="${SCOPE:-all}"
list_changed_paths() {
# Renvoie la liste des chemins modifiés (HEAD~1..HEAD), ou vide si non dispo
git diff --name-only HEAD~1..HEAD 2>/dev/null || true
git -C "${TARGET_DIR:-.}" diff --name-only HEAD~1..HEAD 2>/dev/null || true
}
is_path_changed() {

View File

@ -87,7 +87,7 @@ pushd "$TARGET_DIR" >/dev/null || true
if [[ -s "$after_status_file" ]]; then sed "s/^/ /" "$after_status_file"; else echo " (aucun)"; fi
echo
echo "## Diff par rapport au dernier commit"
git diff --name-status || true
git -C "$TARGET_DIR" diff --name-status || true
} > "$changes_report"
popd >/dev/null || true