Skip to content

Commit 5b04cf5

Browse files
authored
chore: add copilot setup boilerplates (#38037)
1 parent 6664140 commit 5b04cf5

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
jobs:
13+
copilot-setup-steps:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: read
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: lts/*
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Install Playwright Browsers
30+
run: npx playwright install --with-deps
31+
32+
# Customize this step as needed
33+
- name: Build application
34+
run: npx run build
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
jobs:
13+
copilot-setup-steps:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: read
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: lts/*
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Install Playwright Browsers
30+
run: npx playwright install --with-deps
31+
32+
# Customize this step as needed
33+
- name: Build application
34+
run: npx run build

packages/playwright/src/agents/generateAgents.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,36 @@ export class CopilotGenerator {
253253
await deleteFile(`.github/chatmodes/🎭 healer.chatmode.md`, 'legacy healer chatmode');
254254

255255
await VSCodeGenerator.appendToMCPJson();
256+
const cwdFolder = path.basename(process.cwd());
257+
258+
const mcpConfig = {
259+
'mcpServers': {
260+
'playwright-test': {
261+
'type': 'stdio',
262+
'command': 'npx',
263+
'args': [
264+
`--prefix=/home/runner/work/${cwdFolder}/${cwdFolder}`,
265+
'playwright',
266+
'run-test-mcp-server',
267+
'--headless',
268+
`--config=/home/runner/work/${cwdFolder}/${cwdFolder}`
269+
],
270+
'tools': ['*']
271+
}
272+
}
273+
};
274+
275+
if (!fs.existsSync('.github/copilot-setup-steps.yml')) {
276+
const yaml = fs.readFileSync(path.join(__dirname, 'copilot-setup-steps.yml'), 'utf-8');
277+
await writeFile('.github/workflows/copilot-setup-steps.yml', yaml, '🔧', 'GitHub Copilot setup steps');
278+
}
279+
280+
console.log('');
281+
console.log('');
282+
console.log(' 🔧 TODO: GitHub > Settings > Copilot > Coding agent > MCP configuration');
283+
console.log('------------------------------------------------------------------');
284+
console.log(JSON.stringify(mcpConfig, null, 2));
285+
console.log('------------------------------------------------------------------');
256286

257287
initRepoDone();
258288
}

utils/build/build.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,12 @@ copyFiles.push({
631631
to: 'packages/playwright/lib',
632632
});
633633

634+
copyFiles.push({
635+
files: 'packages/playwright/src/agents/*.yml',
636+
from: 'packages/playwright/src',
637+
to: 'packages/playwright/lib',
638+
});
639+
634640
if (watchMode) {
635641
// Run TypeScript for type checking.
636642
steps.push(new ProgramStep({

0 commit comments

Comments
 (0)