Skip to content

Commit 2a6b79f

Browse files
committed
fix: set git identity env vars in extension tests for CI runners
1 parent a084d09 commit 2a6b79f

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎tests/extensions/git/test_git_extension.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,19 @@ def _write_config(project: Path, content: str) -> Path:
8686
return config_path
8787

8888

89+
# Git identity env vars for CI runners without global git config
90+
_GIT_ENV = {
91+
"GIT_AUTHOR_NAME": "Test User",
92+
"GIT_AUTHOR_EMAIL": "test@example.com",
93+
"GIT_COMMITTER_NAME": "Test User",
94+
"GIT_COMMITTER_EMAIL": "test@example.com",
95+
}
96+
97+
8998
def _run_bash(script_name: str, cwd: Path, *args: str, env_extra: dict | None = None) -> subprocess.CompletedProcess:
9099
"""Run an extension bash script."""
91100
script = cwd / ".specify" / "extensions" / "git" / "scripts" / "bash" / script_name
92-
env = {**os.environ, **(env_extra or {})}
101+
env = {**os.environ, **_GIT_ENV, **(env_extra or {})}
93102
return subprocess.run(
94103
["bash", str(script), *args],
95104
cwd=cwd,
@@ -102,11 +111,13 @@ def _run_bash(script_name: str, cwd: Path, *args: str, env_extra: dict | None =
102111
def _run_pwsh(script_name: str, cwd: Path, *args: str) -> subprocess.CompletedProcess:
103112
"""Run an extension PowerShell script."""
104113
script = cwd / ".specify" / "extensions" / "git" / "scripts" / "powershell" / script_name
114+
env = {**os.environ, **_GIT_ENV}
105115
return subprocess.run(
106116
["pwsh", "-NoProfile", "-File", str(script), *args],
107117
cwd=cwd,
108118
capture_output=True,
109119
text=True,
120+
env=env,
110121
)
111122

112123

0 commit comments

Comments
 (0)