Fix workflow YAML for Codex preflight
This commit is contained in:
parent
86127789a3
commit
2fe027dd97
|
|
@ -137,20 +137,20 @@ jobs:
|
||||||
|
|
||||||
$workspaceDir = Join-Path $env:GITHUB_WORKSPACE ".codex-preflight"
|
$workspaceDir = Join-Path $env:GITHUB_WORKSPACE ".codex-preflight"
|
||||||
$script = @"
|
$script = @"
|
||||||
import os
|
import os
|
||||||
from tradingagents.llm_clients.codex_app_server import CodexAppServerAuthError, CodexAppServerBinaryError
|
from tradingagents.llm_clients.codex_app_server import CodexAppServerAuthError, CodexAppServerBinaryError
|
||||||
from tradingagents.llm_clients.codex_preflight import run_codex_preflight
|
from tradingagents.llm_clients.codex_preflight import run_codex_preflight
|
||||||
|
|
||||||
workspace_dir = r"$workspaceDir"
|
workspace_dir = r"$workspaceDir"
|
||||||
summary_path = os.getenv("GITHUB_STEP_SUMMARY")
|
summary_path = os.getenv("GITHUB_STEP_SUMMARY")
|
||||||
|
|
||||||
def write_summary(lines):
|
def write_summary(lines):
|
||||||
if not summary_path:
|
if not summary_path:
|
||||||
return
|
return
|
||||||
with open(summary_path, "a", encoding="utf-8") as handle:
|
with open(summary_path, "a", encoding="utf-8") as handle:
|
||||||
handle.write("\n".join(lines) + "\n")
|
handle.write("\n".join(lines) + "\n")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = run_codex_preflight(
|
result = run_codex_preflight(
|
||||||
codex_binary=None,
|
codex_binary=None,
|
||||||
model="gpt-5.4",
|
model="gpt-5.4",
|
||||||
|
|
@ -158,7 +158,7 @@ try:
|
||||||
workspace_dir=workspace_dir,
|
workspace_dir=workspace_dir,
|
||||||
cleanup_threads=True,
|
cleanup_threads=True,
|
||||||
)
|
)
|
||||||
except CodexAppServerAuthError as exc:
|
except CodexAppServerAuthError as exc:
|
||||||
message = (
|
message = (
|
||||||
"Codex is installed but not logged in for the runner. "
|
"Codex is installed but not logged in for the runner. "
|
||||||
"Run `codex login` or `codex login --device-auth` on the runner machine, "
|
"Run `codex login` or `codex login --device-auth` on the runner machine, "
|
||||||
|
|
@ -174,7 +174,7 @@ except CodexAppServerAuthError as exc:
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
except CodexAppServerBinaryError as exc:
|
except CodexAppServerBinaryError as exc:
|
||||||
message = (
|
message = (
|
||||||
"A usable Codex binary is not available for the runner. "
|
"A usable Codex binary is not available for the runner. "
|
||||||
"Check the `CODEX_BINARY` repository variable or install Codex for the runner service account."
|
"Check the `CODEX_BINARY` repository variable or install Codex for the runner service account."
|
||||||
|
|
@ -192,9 +192,9 @@ except CodexAppServerBinaryError as exc:
|
||||||
)
|
)
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
print("Codex account:", result.account)
|
print("Codex account:", result.account)
|
||||||
print("First available models:", ", ".join(result.models[:8]))
|
print("First available models:", ", ".join(result.models[:8]))
|
||||||
write_summary(
|
write_summary(
|
||||||
[
|
[
|
||||||
"## Codex preflight passed",
|
"## Codex preflight passed",
|
||||||
"",
|
"",
|
||||||
|
|
@ -202,8 +202,8 @@ write_summary(
|
||||||
f"- Models: {', '.join(result.models[:8])}",
|
f"- Models: {', '.join(result.models[:8])}",
|
||||||
f"- Binary: {os.getenv('CODEX_BINARY', '(auto)')}",
|
f"- Binary: {os.getenv('CODEX_BINARY', '(auto)')}",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
"@
|
"@
|
||||||
$script | python -
|
$script | python -
|
||||||
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue