Skip to content
Merged
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
123 changes: 123 additions & 0 deletions .github/workflows/docs-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: "Documentation Validation"

on:
pull_request:
paths:
- 'docs/**'
- 'nodejs/src/**'
- 'python/copilot/**'
- 'go/**/*.go'
- 'dotnet/src/**'
- 'scripts/docs-validation/**'
- '.github/workflows/docs-validation.yml'
workflow_dispatch:
merge_group:

permissions:
contents: read

jobs:
validate-typescript:
name: "Validate TypeScript"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
cache-dependency-path: "nodejs/package-lock.json"

- name: Install SDK dependencies
working-directory: nodejs
run: npm ci --ignore-scripts

- name: Install validation dependencies
working-directory: scripts/docs-validation
run: npm ci

- name: Extract and validate TypeScript
working-directory: scripts/docs-validation
run: npm run extract && npm run validate:ts

validate-python:
name: "Validate Python"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install SDK dependencies
working-directory: python
run: uv sync

- name: Install mypy
run: pip install mypy

- name: Install validation dependencies
working-directory: scripts/docs-validation
run: npm ci

- name: Extract and validate Python
working-directory: scripts/docs-validation
run: npm run extract && npm run validate:py

validate-go:
name: "Validate Go"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22

- uses: actions/setup-go@v5
with:
go-version: "1.23"
cache-dependency-path: "go/go.sum"

- name: Install validation dependencies
working-directory: scripts/docs-validation
run: npm ci

- name: Extract and validate Go
working-directory: scripts/docs-validation
run: npm run extract && npm run validate:go

validate-csharp:
name: "Validate C#"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22

- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Install validation dependencies
working-directory: scripts/docs-validation
run: npm ci

- name: Restore SDK dependencies
working-directory: dotnet
run: dotnet restore

- name: Extract and validate C#
working-directory: scripts/docs-validation
run: npm run extract && npm run validate:cs
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Documentation validation output
docs/.validation/
11 changes: 7 additions & 4 deletions docs/auth/byok.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,14 @@ import (
)

func main() {
ctx := context.Background()
client := copilot.NewClient(nil)
if err := client.Start(); err != nil {
if err := client.Start(ctx); err != nil {
panic(err)
}
defer client.Stop()

session, err := client.CreateSession(context.Background(), &copilot.SessionConfig{
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
Model: "gpt-5.2-codex", // Your deployment name
Provider: &copilot.ProviderConfig{
Type: "openai",
Expand All @@ -123,9 +124,9 @@ func main() {
panic(err)
}

response, err := session.SendAndWait(copilot.MessageOptions{
response, err := session.SendAndWait(ctx, copilot.MessageOptions{
Prompt: "What is 2+2?",
}, 0)
})
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -325,6 +326,7 @@ const session = await client.createSession({

For Azure OpenAI endpoints (`*.openai.azure.com`), use the correct type:

<!-- docs-validate: skip -->
```typescript
// ❌ Wrong: Using "openai" type with native Azure endpoint
provider: {
Expand All @@ -341,6 +343,7 @@ provider: {

However, if your Azure AI Foundry deployment provides an OpenAI-compatible endpoint path (e.g., `/openai/v1/`), use `type: "openai"`:

<!-- docs-validate: skip -->
```typescript
// ✅ Correct: OpenAI-compatible Azure AI Foundry endpoint
provider: {
Expand Down
5 changes: 5 additions & 0 deletions docs/auth/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ await client.start()
<details>
<summary><strong>Go</strong></summary>

<!-- docs-validate: skip -->
```go
import copilot "github.com/github/copilot-sdk/go"

Expand Down Expand Up @@ -119,6 +120,7 @@ await client.start()
<details>
<summary><strong>Go</strong></summary>

<!-- docs-validate: skip -->
```go
import copilot "github.com/github/copilot-sdk/go"

Expand All @@ -133,6 +135,7 @@ client := copilot.NewClient(&copilot.ClientOptions{
<details>
<summary><strong>.NET</strong></summary>

<!-- docs-validate: skip -->
```csharp
using GitHub.Copilot.SDK;

Expand Down Expand Up @@ -251,6 +254,7 @@ const client = new CopilotClient({
<details>
<summary><strong>Python</strong></summary>

<!-- docs-validate: skip -->
```python
client = CopilotClient({
"use_logged_in_user": False, # Only use explicit tokens
Expand All @@ -262,6 +266,7 @@ client = CopilotClient({
<details>
<summary><strong>Go</strong></summary>

<!-- docs-validate: skip -->
```go
client := copilot.NewClient(&copilot.ClientOptions{
UseLoggedInUser: copilot.Bool(false), // Only use explicit tokens
Expand Down
9 changes: 6 additions & 3 deletions docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ const client = new CopilotClient({
```python
from copilot import CopilotClient

client = CopilotClient(log_level="debug")
client = CopilotClient({"log_level": "debug"})
```

</details>

<details>
<summary><strong>Go</strong></summary>

<!-- docs-validate: skip -->
```go
import copilot "github.com/github/copilot-sdk/go"

Expand All @@ -57,6 +58,7 @@ client := copilot.NewClient(&copilot.ClientOptions{
<details>
<summary><strong>.NET</strong></summary>

<!-- docs-validate: skip -->
```csharp
using GitHub.Copilot.SDK;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -108,6 +110,7 @@ const client = new CopilotClient({
<details>
<summary><strong>Go</strong></summary>

<!-- docs-validate: skip -->
```go
// The Go SDK does not currently support passing extra CLI arguments.
// For custom log directories, run the CLI manually with --log-dir
Expand Down Expand Up @@ -161,7 +164,7 @@ var client = new CopilotClient(new CopilotClientOptions
<summary><strong>Python</strong></summary>

```python
client = CopilotClient(cli_path="/usr/local/bin/copilot")
client = CopilotClient({"cli_path": "/usr/local/bin/copilot"})
```
</details>

Expand Down Expand Up @@ -214,7 +217,7 @@ var client = new CopilotClient(new CopilotClientOptions

```python
import os
client = CopilotClient(github_token=os.environ.get("GITHUB_TOKEN"))
client = CopilotClient({"github_token": os.environ.get("GITHUB_TOKEN")})
```
</details>

Expand Down
Loading