Skip to content

Commit cbb3f89

Browse files
CopilotBenjaminMichaelisCopilot
authored
feat: Add copilot-setup-steps workflow and shared setup composite actions for Copilot coding agent environment (#65)
Adds `.github/workflows/copilot-setup-steps.yml` so GitHub Copilot's coding agent gets a fully prepared, pre-built environment before it starts working. Also introduces shared composite actions to eliminate setup duplication across CI jobs. ## Changes - **New workflow** (`.github/workflows/copilot-setup-steps.yml`): job named `copilot-setup-steps` (required name for Copilot pickup), runs on `ubuntu-latest`, `contents: read` only - **Auto-validation**: triggers on push/PR when the file itself changes, plus `workflow_dispatch` for manual testing - **New composite action** (`.github/actions/setup-node/action.yml`): sets up Node.js 20, runs `npm ci` + `npm run buildProd` for all four JS packages (`microsoft-trydotnet`, `microsoft-trydotnet-editor`, `microsoft-trydotnet-styles`, `microsoft-learn-mock`); optional `build` input (default `true`) - **New composite action** (`.github/actions/setup-dotnet/action.yml`): sets up .NET via `global.json`, configures NuGet cache, runs `dotnet restore` + `dotnet build`; optional `build` input (default `true`) - **Shared setup with CI**: all three main jobs in `Build-Test-And-Deploy.yaml` (`build-and-test`, `build-and-test-windows`, `integration-tests`) now call both composite actions, removing ~90 lines of duplicated setup - **Full builds for Copilot**: `copilot-setup-steps.yml` runs both composite actions with `build: true` (default), so JS assets and .NET binaries are compiled and ready before the agent starts <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/IntelliTect/try/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> Co-authored-by: Benjamin Michaelis <github@relay.benjamin.michaelis.net> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4634bff commit cbb3f89

4 files changed

Lines changed: 147 additions & 147 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Setup .NET Environment'
2+
description: 'Set up .NET SDK, configure dependency caching, restore, and optionally build'
3+
inputs:
4+
build:
5+
description: 'Whether to run dotnet build after restore'
6+
required: false
7+
default: 'true'
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: Set up .NET
12+
uses: actions/setup-dotnet@v5
13+
with:
14+
global-json-file: global.json
15+
16+
- name: Set up dependency caching for faster builds
17+
uses: actions/cache@v5
18+
with:
19+
path: |
20+
~/.nuget/packages
21+
${{ github.workspace }}/**/obj/project.assets.json
22+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
23+
restore-keys: |
24+
${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
25+
${{ runner.os }}-nuget-
26+
27+
- name: Restore .NET dependencies
28+
shell: bash
29+
run: dotnet restore
30+
31+
- name: Build with dotnet
32+
if: inputs.build == 'true'
33+
shell: bash
34+
run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: 'Setup Node.js Environment'
2+
description: 'Set up Node.js, install npm dependencies, and optionally build all JS packages'
3+
inputs:
4+
build:
5+
description: 'Whether to run npm buildProd after install'
6+
required: false
7+
default: 'true'
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: Set up Node.js
12+
uses: actions/setup-node@v4
13+
with:
14+
node-version: '20'
15+
cache: 'npm'
16+
cache-dependency-path: 'src/**/package-lock.json'
17+
18+
- name: Install microsoft-trydotnet dependencies
19+
shell: bash
20+
working-directory: src/microsoft-trydotnet
21+
run: npm ci
22+
23+
- name: Build microsoft-trydotnet
24+
if: inputs.build == 'true'
25+
shell: bash
26+
working-directory: src/microsoft-trydotnet
27+
run: npm run buildProd
28+
29+
- name: Install microsoft-trydotnet-editor dependencies
30+
shell: bash
31+
working-directory: src/microsoft-trydotnet-editor
32+
run: npm ci
33+
34+
- name: Build microsoft-trydotnet-editor
35+
if: inputs.build == 'true'
36+
shell: bash
37+
working-directory: src/microsoft-trydotnet-editor
38+
run: npm run buildProd
39+
40+
- name: Install microsoft-trydotnet-styles dependencies
41+
shell: bash
42+
working-directory: src/microsoft-trydotnet-styles
43+
run: npm ci
44+
45+
- name: Build microsoft-trydotnet-styles
46+
if: inputs.build == 'true'
47+
shell: bash
48+
working-directory: src/microsoft-trydotnet-styles
49+
run: npm run buildProd
50+
51+
- name: Install microsoft-learn-mock dependencies
52+
shell: bash
53+
working-directory: src/microsoft-learn-mock
54+
run: npm ci
55+
56+
- name: Build microsoft-learn-mock
57+
if: inputs.build == 'true'
58+
shell: bash
59+
working-directory: src/microsoft-learn-mock
60+
run: npm run buildProd

.github/workflows/Build-Test-And-Deploy.yaml

Lines changed: 17 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -19,61 +19,19 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v6
2121

22-
- name: Set up Node.js
23-
uses: actions/setup-node@v4
24-
with:
25-
node-version: '20'
26-
cache: 'npm'
27-
cache-dependency-path: 'src/**/package-lock.json'
22+
- name: Set up Node.js environment
23+
uses: ./.github/actions/setup-node
24+
25+
- name: Set up .NET environment
26+
uses: ./.github/actions/setup-dotnet
2827

29-
- name: Build and test microsoft-trydotnet
28+
- name: Run ciTest for microsoft-trydotnet
3029
working-directory: src/microsoft-trydotnet
31-
run: |
32-
npm ci
33-
npm run buildProd
34-
npm run ciTest
30+
run: npm run ciTest
3531

36-
- name: Build and test microsoft-trydotnet-editor
32+
- name: Run ciTest for microsoft-trydotnet-editor
3733
working-directory: src/microsoft-trydotnet-editor
38-
run: |
39-
npm ci
40-
npm run buildProd
41-
npm run ciTest
42-
43-
- name: Build microsoft-trydotnet-styles
44-
working-directory: src/microsoft-trydotnet-styles
45-
run: |
46-
npm ci
47-
npm run buildProd
48-
49-
- name: Build microsoft-learn-mock
50-
working-directory: src/microsoft-learn-mock
51-
run: |
52-
npm ci
53-
npm run buildProd
54-
55-
- name: Set up .NET
56-
uses: actions/setup-dotnet@v5
57-
with:
58-
global-json-file: global.json
59-
60-
- name: Set up dependency caching for faster builds
61-
uses: actions/cache@v5
62-
id: nuget-cache
63-
with:
64-
path: |
65-
~/.nuget/packages
66-
${{ github.workspace }}/**/obj/project.assets.json
67-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
68-
restore-keys: |
69-
${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
70-
${{ runner.os }}-nuget-
71-
72-
- name: Restore with dotnet
73-
run: dotnet restore
74-
75-
- name: Build with dotnet
76-
run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore
34+
run: npm run ciTest
7735

7836
- name: Run .NET Tests
7937
id: run-dotnet-tests
@@ -128,55 +86,11 @@ jobs:
12886
steps:
12987
- uses: actions/checkout@v6
13088

131-
- name: Set up Node.js
132-
uses: actions/setup-node@v4
133-
with:
134-
node-version: '20'
135-
cache: 'npm'
136-
cache-dependency-path: 'src/**/package-lock.json'
137-
138-
- name: Build microsoft-trydotnet
139-
working-directory: src/microsoft-trydotnet
140-
run: |
141-
npm ci
142-
npm run buildProd
143-
144-
- name: Build microsoft-trydotnet-editor
145-
working-directory: src/microsoft-trydotnet-editor
146-
run: |
147-
npm ci
148-
npm run buildProd
149-
150-
- name: Build microsoft-trydotnet-styles
151-
working-directory: src/microsoft-trydotnet-styles
152-
run: |
153-
npm ci
154-
npm run buildProd
155-
156-
- name: Build microsoft-learn-mock
157-
working-directory: src/microsoft-learn-mock
158-
run: |
159-
npm ci
160-
npm run buildProd
161-
162-
- name: Set up .NET
163-
uses: actions/setup-dotnet@v5
164-
with:
165-
global-json-file: global.json
166-
167-
- name: Set up dependency caching for faster builds
168-
uses: actions/cache@v5
169-
with:
170-
path: ~/.nuget/packages
171-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
172-
restore-keys: |
173-
${{ runner.os }}-nuget-
174-
175-
- name: Restore with dotnet
176-
run: dotnet restore
89+
- name: Set up Node.js environment
90+
uses: ./.github/actions/setup-node
17791

178-
- name: Build with dotnet
179-
run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore
92+
- name: Set up .NET environment
93+
uses: ./.github/actions/setup-dotnet
18094

18195
- name: Run .NET Tests
18296
id: run-dotnet-tests
@@ -202,55 +116,11 @@ jobs:
202116
steps:
203117
- uses: actions/checkout@v6
204118

205-
- name: Set up Node.js
206-
uses: actions/setup-node@v4
207-
with:
208-
node-version: '20'
209-
cache: 'npm'
210-
cache-dependency-path: 'src/**/package-lock.json'
211-
212-
- name: Build microsoft-trydotnet
213-
working-directory: src/microsoft-trydotnet
214-
run: |
215-
npm ci
216-
npm run buildProd
217-
218-
- name: Build microsoft-trydotnet-editor
219-
working-directory: src/microsoft-trydotnet-editor
220-
run: |
221-
npm ci
222-
npm run buildProd
223-
224-
- name: Build microsoft-trydotnet-styles
225-
working-directory: src/microsoft-trydotnet-styles
226-
run: |
227-
npm ci
228-
npm run buildProd
229-
230-
- name: Build microsoft-learn-mock
231-
working-directory: src/microsoft-learn-mock
232-
run: |
233-
npm ci
234-
npm run buildProd
235-
236-
- name: Set up .NET
237-
uses: actions/setup-dotnet@v5
238-
with:
239-
global-json-file: global.json
240-
241-
- name: Set up dependency caching for faster builds
242-
uses: actions/cache@v5
243-
with:
244-
path: ~/.nuget/packages
245-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
246-
restore-keys: |
247-
${{ runner.os }}-nuget-
248-
249-
- name: Restore with dotnet
250-
run: dotnet restore
119+
- name: Set up Node.js environment
120+
uses: ./.github/actions/setup-node
251121

252-
- name: Build with dotnet
253-
run: dotnet build -p:ContinuousIntegrationBuild=True -p:ReleaseDateAttribute=True --configuration Release --no-restore
122+
- name: Set up .NET environment
123+
uses: ./.github/actions/setup-dotnet
254124

255125
- name: Run .NET Integration Tests
256126
id: run-dotnet-integration-tests
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
- .github/actions/setup-node/action.yml
11+
- .github/actions/setup-dotnet/action.yml
12+
pull_request:
13+
paths:
14+
- .github/workflows/copilot-setup-steps.yml
15+
- .github/actions/setup-node/action.yml
16+
- .github/actions/setup-dotnet/action.yml
17+
18+
jobs:
19+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
20+
copilot-setup-steps:
21+
runs-on: ubuntu-latest
22+
23+
# Set the permissions to the lowest permissions possible needed for your steps.
24+
# Copilot will be given its own token for its operations.
25+
permissions:
26+
# Needed to clone the repository to install dependencies.
27+
contents: read
28+
29+
steps:
30+
- uses: actions/checkout@v6
31+
32+
- name: Set up Node.js environment
33+
uses: ./.github/actions/setup-node
34+
35+
- name: Set up .NET environment
36+
uses: ./.github/actions/setup-dotnet

0 commit comments

Comments
 (0)