Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/opencode/src/provider/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,8 @@ const layer = Layer.effect(
for (const [id, provider] of Object.entries(database)) {
const providerID = ProviderV2.ID.make(id)
if (disabled.has(providerID)) continue
// GITHUB_TOKEN is commonly set for GitHub tooling; github-copilot must only activate through its OAuth plugin flow.
if (providerID === ProviderV2.ID.githubCopilot) continue
const apiKey = provider.env.map((item) => envs[item]).find(Boolean)
if (!apiKey) continue
mergeProvider(providerID, {
Expand Down
8 changes: 8 additions & 0 deletions packages/opencode/test/provider/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ it.instance("provider loaded from env variable", () =>
}),
)

it.instance("GITHUB_TOKEN does not activate github-copilot", () =>
Effect.gen(function* () {
yield* setProcessEnv("GITHUB_TOKEN", "test-github-token")
const providers = yield* list
expect(providers[ProviderV2.ID.githubCopilot]).toBeUndefined()
}),
)

it.instance(
"provider loaded from config with apiKey option",
Effect.gen(function* () {
Expand Down
Loading