Skip to content

Commit 7eed004

Browse files
committed
Simplify docs validation workflow
- Remove separate extract job and artifact upload/download - Each language job now extracts and validates independently - Jobs run in parallel without dependencies - Remove docs/.gitignore (no longer needed)
1 parent a7218db commit 7eed004

196 files changed

Lines changed: 3943 additions & 77 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.

.github/workflows/docs-validation.yml

Lines changed: 20 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,8 @@ permissions:
1717
contents: read
1818

1919
jobs:
20-
extract:
21-
name: "Extract Code Blocks"
22-
runs-on: ubuntu-latest
23-
steps:
24-
- uses: actions/checkout@v4
25-
26-
- uses: actions/setup-node@v4
27-
with:
28-
node-version: 22
29-
cache: "npm"
30-
cache-dependency-path: "scripts/docs-validation/package-lock.json"
31-
32-
- name: Install extraction dependencies
33-
working-directory: scripts/docs-validation
34-
run: npm ci
35-
36-
- name: Extract code blocks
37-
working-directory: scripts/docs-validation
38-
run: npm run extract
39-
40-
- name: Upload extracted code
41-
uses: actions/upload-artifact@v4
42-
with:
43-
name: extracted-code
44-
path: docs/.validation/
45-
retention-days: 1
46-
4720
validate-typescript:
4821
name: "Validate TypeScript"
49-
needs: extract
5022
runs-on: ubuntu-latest
5123
steps:
5224
- uses: actions/checkout@v4
@@ -65,23 +37,20 @@ jobs:
6537
working-directory: scripts/docs-validation
6638
run: npm ci
6739

68-
- name: Download extracted code
69-
uses: actions/download-artifact@v4
70-
with:
71-
name: extracted-code
72-
path: docs/.validation/
73-
74-
- name: Validate TypeScript
40+
- name: Extract and validate TypeScript
7541
working-directory: scripts/docs-validation
76-
run: npm run validate:ts
42+
run: npm run extract && npm run validate:ts
7743

7844
validate-python:
7945
name: "Validate Python"
80-
needs: extract
8146
runs-on: ubuntu-latest
8247
steps:
8348
- uses: actions/checkout@v4
8449

50+
- uses: actions/setup-node@v4
51+
with:
52+
node-version: 22
53+
8554
- uses: actions/setup-python@v5
8655
with:
8756
python-version: "3.12"
@@ -100,79 +69,55 @@ jobs:
10069
working-directory: scripts/docs-validation
10170
run: npm ci
10271

103-
- uses: actions/setup-node@v4
104-
with:
105-
node-version: 22
106-
107-
- name: Download extracted code
108-
uses: actions/download-artifact@v4
109-
with:
110-
name: extracted-code
111-
path: docs/.validation/
112-
113-
- name: Validate Python
72+
- name: Extract and validate Python
11473
working-directory: scripts/docs-validation
115-
run: npm run validate:py
74+
run: npm run extract && npm run validate:py
11675

11776
validate-go:
11877
name: "Validate Go"
119-
needs: extract
12078
runs-on: ubuntu-latest
12179
steps:
12280
- uses: actions/checkout@v4
12381

82+
- uses: actions/setup-node@v4
83+
with:
84+
node-version: 22
85+
12486
- uses: actions/setup-go@v5
12587
with:
12688
go-version: "1.23"
12789
cache-dependency-path: "go/go.sum"
12890

129-
- uses: actions/setup-node@v4
130-
with:
131-
node-version: 22
132-
13391
- name: Install validation dependencies
13492
working-directory: scripts/docs-validation
13593
run: npm ci
13694

137-
- name: Download extracted code
138-
uses: actions/download-artifact@v4
139-
with:
140-
name: extracted-code
141-
path: docs/.validation/
142-
143-
- name: Validate Go
95+
- name: Extract and validate Go
14496
working-directory: scripts/docs-validation
145-
run: npm run validate:go
97+
run: npm run extract && npm run validate:go
14698

14799
validate-csharp:
148100
name: "Validate C#"
149-
needs: extract
150101
runs-on: ubuntu-latest
151102
steps:
152103
- uses: actions/checkout@v4
153104

154-
- uses: actions/setup-dotnet@v4
155-
with:
156-
dotnet-version: "8.0.x"
157-
158105
- uses: actions/setup-node@v4
159106
with:
160107
node-version: 22
161108

109+
- uses: actions/setup-dotnet@v4
110+
with:
111+
dotnet-version: "8.0.x"
112+
162113
- name: Install validation dependencies
163114
working-directory: scripts/docs-validation
164115
run: npm ci
165116

166-
- name: Download extracted code
167-
uses: actions/download-artifact@v4
168-
with:
169-
name: extracted-code
170-
path: docs/.validation/
171-
172117
- name: Restore SDK dependencies
173118
working-directory: dotnet
174119
run: dotnet restore
175120

176-
- name: Validate C#
121+
- name: Extract and validate C#
177122
working-directory: scripts/docs-validation
178-
run: npm run validate:cs
123+
run: npm run extract && npm run validate:cs

docs/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Library</OutputType>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<NoWarn>CS8019;CS0168;CS0219</NoWarn>
8+
</PropertyGroup>
9+
<ItemGroup>
10+
<ProjectReference Include="/Users/patrick/projects/copilot-sdk/dotnet/src/GitHub.Copilot.SDK.csproj" />
11+
</ItemGroup>
12+
</Project>

docs/.validation/csharp/byok_29.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Source: auth/byok.md:143
2+
using GitHub.Copilot.SDK;
3+
4+
await using var client = new CopilotClient();
5+
await using var session = await client.CreateSessionAsync(new SessionConfig
6+
{
7+
Model = "gpt-5.2-codex", // Your deployment name
8+
Provider = new ProviderConfig
9+
{
10+
Type = "openai",
11+
BaseUrl = "https://your-resource.openai.azure.com/openai/v1/",
12+
WireApi = "responses", // Use "completions" for older models
13+
ApiKey = Environment.GetEnvironmentVariable("FOUNDRY_API_KEY"),
14+
},
15+
});
16+
17+
var response = await session.SendAndWaitAsync(new MessageOptions
18+
{
19+
Prompt = "What is 2+2?",
20+
});
21+
Console.WriteLine(response?.Data.Content);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Source: mcp/debugging.md:269
2+
// Windows needs cmd /c for npx
3+
["filesystem"] = new McpLocalServerConfig
4+
{
5+
Type = "local",
6+
Command = "cmd",
7+
Args = new List<string> { "/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:\\allowed\\path" },
8+
Tools = new List<string> { "*" },
9+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Source: debugging.md:61
2+
using GitHub.Copilot.SDK;
3+
using Microsoft.Extensions.Logging;
4+
5+
// Using ILogger
6+
var loggerFactory = LoggerFactory.Create(builder =>
7+
{
8+
builder.SetMinimumLevel(LogLevel.Debug);
9+
builder.AddConsole();
10+
});
11+
12+
var client = new CopilotClient(new CopilotClientOptions
13+
{
14+
LogLevel = "debug",
15+
Logger = loggerFactory.CreateLogger<CopilotClient>()
16+
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Source: debugging.md:124
2+
var client = new CopilotClient(new CopilotClientOptions
3+
{
4+
CliArgs = new[] { "--log-dir", "/path/to/logs" }
5+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Source: mcp/debugging.md:245
2+
// Correct configuration for .NET exe
3+
["my-dotnet-server"] = new McpLocalServerConfig
4+
{
5+
Type = "local",
6+
Command = @"C:\Tools\MyServer\MyServer.exe", // Full path with .exe
7+
Args = new List<string>(),
8+
Cwd = @"C:\Tools\MyServer", // Set working directory
9+
Tools = new List<string> { "*" },
10+
}
11+
12+
// For dotnet tool (DLL)
13+
["my-dotnet-tool"] = new McpLocalServerConfig
14+
{
15+
Type = "local",
16+
Command = "dotnet",
17+
Args = new List<string> { @"C:\Tools\MyTool\MyTool.dll" },
18+
Cwd = @"C:\Tools\MyTool",
19+
Tools = new List<string> { "*" },
20+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Source: hooks/error-handling.md:52
2+
public delegate Task<ErrorOccurredHookOutput?> ErrorOccurredHandler(
3+
ErrorOccurredHookInput input,
4+
HookInvocation invocation);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Source: hooks/error-handling.md:142
2+
var session = await client.CreateSessionAsync(new SessionConfig
3+
{
4+
Hooks = new SessionHooks
5+
{
6+
OnErrorOccurred = (input, invocation) =>
7+
{
8+
Console.Error.WriteLine($"[{invocation.SessionId}] Error: {input.Error}");
9+
Console.Error.WriteLine($" Context: {input.ErrorContext}");
10+
Console.Error.WriteLine($" Recoverable: {input.Recoverable}");
11+
return Task.FromResult<ErrorOccurredHookOutput?>(null);
12+
},
13+
},
14+
});

0 commit comments

Comments
 (0)