Skip to content

Commit f3321b2

Browse files
Drop github_token boilerplate from scenario fixtures
Every scenario explicitly threaded GITHUB_TOKEN from the parent env into the SDK client options: - Python: github_token=os.environ.get("GITHUB_TOKEN") - TypeScript: gitHubToken: process.env.GITHUB_TOKEN - .NET: GitHubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN") - Go: GitHubToken: os.Getenv("GITHUB_TOKEN") - Rust: opts.github_token = std::env::var("GITHUB_TOKEN").ok() This is pure boilerplate noise: the runtime CLI already reads GITHUB_TOKEN from its inherited environment when no token is provided to the SDK, so the explicit pass-through is redundant and nothing a real consumer would write. Drop the line in every scenario across all 5 languages. Exception: `auth/gh-app` keeps explicit github_token plumbing because the whole point of that scenario is to demonstrate passing an OAuth-derived token obtained at runtime. Also clean up the resulting unused imports: - Python: `import os` removed where it was only used for GITHUB_TOKEN (ruff autofixed). - Go: `"os"` import removed where it was only used for GITHUB_TOKEN (gofmt happy). - Rust: `let mut opts = ClientOptions::default(); ...; Client::start(opts)` collapsed to `Client::start(ClientOptions::default())` where opts is no longer mutated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d8c0c7c commit f3321b2

112 files changed

Lines changed: 145 additions & 346 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/scenarios/auth/byok-anthropic/go/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ func main() {
5959
}
6060

6161
if response != nil {
62-
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
63-
fmt.Println(d.Content)
64-
}
65-
}
62+
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
63+
fmt.Println(d.Content)
64+
}
65+
}
6666
}

test/scenarios/auth/byok-azure/go/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ func main() {
6363
}
6464

6565
if response != nil {
66-
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
67-
fmt.Println(d.Content)
68-
}
69-
}
66+
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
67+
fmt.Println(d.Content)
68+
}
69+
}
7070
}

test/scenarios/auth/byok-ollama/go/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ func main() {
5555
}
5656

5757
if response != nil {
58-
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
59-
fmt.Println(d.Content)
60-
}
61-
}
58+
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
59+
fmt.Println(d.Content)
60+
}
61+
}
6262
}

test/scenarios/auth/byok-openai/go/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func main() {
5454
}
5555

5656
if response != nil {
57-
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
58-
fmt.Println(d.Content)
59-
}
60-
}
57+
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
58+
fmt.Println(d.Content)
59+
}
60+
}
6161
}

test/scenarios/auth/gh-app/go/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ func main() {
186186
log.Fatal(err)
187187
}
188188
if response != nil {
189-
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
190-
fmt.Println(d.Content)
191-
}
192-
}
189+
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
190+
fmt.Println(d.Content)
191+
}
192+
}
193193
}

test/scenarios/bundling/app-direct-server/go/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ func main() {
4141
}
4242

4343
if response != nil {
44-
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
45-
fmt.Println(d.Content)
46-
}
47-
}
44+
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
45+
fmt.Println(d.Content)
46+
}
47+
}
4848
}

test/scenarios/bundling/container-proxy/go/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ func main() {
4141
}
4242

4343
if response != nil {
44-
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
45-
fmt.Println(d.Content)
46-
}
47-
}
44+
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
45+
fmt.Println(d.Content)
46+
}
47+
}
4848
}

test/scenarios/bundling/fully-bundled/csharp/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using var client = new CopilotClient(new CopilotClientOptions
44
{
55
Connection = RuntimeConnection.ForStdio(path: Environment.GetEnvironmentVariable("COPILOT_CLI_PATH")),
6-
GitHubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN"),
76
});
87

98
await client.StartAsync();

test/scenarios/bundling/fully-bundled/go/main.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ import (
44
"context"
55
"fmt"
66
"log"
7-
"os"
87

98
copilot "github.com/github/copilot-sdk/go"
109
)
1110

1211
func main() {
1312
// Go SDK auto-reads COPILOT_CLI_PATH from env
14-
client := copilot.NewClient(&copilot.ClientOptions{
15-
GitHubToken: os.Getenv("GITHUB_TOKEN"),
16-
})
13+
client := copilot.NewClient(&copilot.ClientOptions{})
1714

1815
ctx := context.Background()
1916
if err := client.Start(ctx); err != nil {
@@ -37,8 +34,8 @@ func main() {
3734
}
3835

3936
if response != nil {
40-
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
41-
fmt.Println(d.Content)
42-
}
43-
}
37+
if d, ok := response.Data.(*copilot.AssistantMessageData); ok {
38+
fmt.Println(d.Content)
39+
}
40+
}
4441
}

test/scenarios/bundling/fully-bundled/python/main.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import asyncio
2-
import os
32

43
from copilot import CopilotClient
54

65

76
async def main():
8-
client = CopilotClient(
9-
github_token=os.environ.get("GITHUB_TOKEN"),
10-
)
7+
client = CopilotClient()
118

129
try:
1310
session = await client.create_session(model="claude-haiku-4.5")

0 commit comments

Comments
 (0)