ci: bind opencode API key explicitly via opencode.json
PR Check / Dockerfile lint (droast) (pull_request) Skipped
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / ESLint (pull_request) Successful in 35s
PR Check / Typecheck (pull_request) Successful in 37s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / AI code review (opencode) (pull_request) Failing after 11s
PR Check / Dockerfile lint (droast) (pull_request) Skipped
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / ESLint (pull_request) Successful in 35s
PR Check / Typecheck (pull_request) Successful in 37s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 9s
PR Check / AI code review (opencode) (pull_request) Failing after 11s
The headless CI container has no stored credentials, so auth depends entirely on the injected key. Generate an opencode.json at runtime that binds OPENCODE_API_KEY to the opencode-go provider explicitly, removing any dependence on env-var-to-provider mapping behavior.
This commit is contained in:
1 parent
a6761fae9a
commit
5f1d64db90
1 file changed
+13
-3
@@ -210,9 +210,19 @@ jobs:
|
|||||||
# (variants: high, max). NOTE the provider prefix must be
|
# (variants: high, max). NOTE the provider prefix must be
|
||||||
# "opencode-go", NOT "opencode" (Zen is a different, pay-per-call
|
# "opencode-go", NOT "opencode" (Zen is a different, pay-per-call
|
||||||
# provider and fails with 'Insufficient account funds').
|
# provider and fails with 'Insufficient account funds').
|
||||||
# Output is redirected (not piped through tee): if opencode fails,
|
#
|
||||||
# the job must fail here so the error log is never posted as a
|
# Belt and suspenders on auth: OPENCODE_API_KEY is exported for
|
||||||
# "review" comment.
|
# env-based pickup, AND an opencode.json is generated that binds
|
||||||
|
# the key to the opencode-go provider explicitly - so headless CI
|
||||||
|
# never depends on env-var mapping behavior.
|
||||||
|
printf '{
|
||||||
|
"$schema": "https://opencode.ai/config.json",
|
||||||
|
"provider": {
|
||||||
|
"opencode-go": {
|
||||||
|
"options": { "apiKey": "%s" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' "$OPENCODE_API_KEY" > opencode.json
|
||||||
# --print-logs: surface auth/provider errors in the CI log instead
|
# --print-logs: surface auth/provider errors in the CI log instead
|
||||||
# of failing with an opaque exit code
|
# of failing with an opaque exit code
|
||||||
opencode run \
|
opencode run \
|
||||||
|
|||||||
Reference in new issue
Block a user