fix: preserve local env overrides in shell pipelines
Some checks failed
CI / go-test (push) Has been cancelled
CI / scripts-regression (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / docker-build (push) Has been cancelled

This commit is contained in:
phamnazage-jpg
2026-05-30 16:38:38 +08:00
parent 9ff023dab4
commit 98b9203302
13 changed files with 402 additions and 97 deletions

21
scripts/load_project_env.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
PATH_ARG="${1:-}"
[[ -n "$PATH_ARG" && -f "$PATH_ARG" ]] || exit 0
python3 - <<'PY' "$PATH_ARG"
from pathlib import Path
import sys
for raw in Path(sys.argv[1]).read_text().splitlines():
s = raw.strip()
if not s or s.startswith('#') or '=' not in s:
continue
key, value = s.split('=', 1)
key = key.strip()
value = value.strip().strip('"').strip("'")
if not key or not value:
continue
print(f"{key}={value}")
PY