Skip to content

Commit 085a38b

Browse files
katriendgCopilotWilliamBerryiii
authored
feat(workflow): add copilot-setup-steps.yml for Coding Agent environment (#398)
## Description Adds `copilot-setup-steps.yml` workflow to bridge the devcontainer environment to GitHub Actions runners for Copilot Coding Agent. The workflow pre-installs Node.js 20, Python 3.11, and PowerShell modules to match local development capabilities, enabling agents to use the same npm scripts for validation in the cloud environment. - Created `.github/workflows/copilot-setup-steps.yml` with SHA-pinned actions for `checkout`, `setup-node`, and `setup-python` - Added tool verification step confirming availability of `node`, `npm`, `python3`, `pwsh`, and `shellcheck` - Updated `.github/copilot-instructions.md` with new "Coding Agent Environment" section documenting pre-installed tools and npm script usage - Applied minimal `contents: read` permissions following principle of least privilege ## Related Issue(s) Closes #388 ## Type of Change Select all that apply: **Code & Documentation:** - [ ] Bug fix (non-breaking change fixing an issue) - [x] New feature (non-breaking change adding functionality) - [ ] Breaking change (fix or feature causing existing functionality to change) - [ ] Documentation update **Infrastructure & Configuration:** - [x] GitHub Actions workflow - [ ] Linting configuration (markdown, PowerShell, etc.) - [ ] Security configuration - [ ] DevContainer configuration - [ ] Dependency update **AI Artifacts:** - [ ] Reviewed contribution with `prompt-builder` agent and addressed all feedback - [ ] Copilot instructions (`.github/instructions/*.instructions.md`) - [ ] Copilot prompt (`.github/prompts/*.prompt.md`) - [ ] Copilot agent (`.github/agents/*.agent.md`) **Other:** - [ ] Script/automation (`.ps1`, `.sh`, `.py`) - [ ] Other (please describe): ## Sample Prompts (for AI Artifact Contributions) N/A - only updated copilot-instructions.md for the cloud agent. ## Testing - Workflow triggers on push/PR to its own path for validation - Tool verification step confirms all dependencies are available - npm scripts listed via `npm run --list` for agent reference ## Checklist ### Required Checks - [ ] Documentation is updated (if applicable) - This will be a follow-up PR to update documentation after workflow is merged and verified - [x] Files follow existing naming conventions - [x] Changes are backwards compatible (if applicable) - [ ] Tests added for new functionality (if applicable) ### AI Artifact Contributions - [x] Copilot instructions (`.github/instructions/*.instructions.md`) ### Required Automated Checks The following validation commands must pass before merging: - [x] Markdown linting: `npm run lint:md` - [x] Spell checking: `npm run spell-check` - [ ] Frontmatter validation: `npm run lint:frontmatter` - [x] Link validation: `npm run lint:md-links` - [ ] PowerShell analysis: `npm run lint:ps` ## Security Considerations - [x] This PR does not contain any sensitive or NDA information - [ ] Any new dependencies have been reviewed for security issues - [x] Security-related scripts follow the principle of least privilege ## Additional Notes The workflow uses SHA-pinned actions for security: - `actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd` (v4.2.2) - `actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238` (v4.1.0) - `actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f` (v5.1.1) The job is named `copilot-setup-steps` as required by GitHub Copilot documentation for automatic recognition. **Intentionally excluded or leveraged from runners:** - **gitleaks** - Secret scanning runs in CI workflows via `security-scan.yml`, following the principle that security validation belongs in the pipeline, not the agent's editing environment. GitHub's push protection provides an additional layer of defense. - **shellcheck** - Pre-installed on ubuntu-latest runners (v0.9.0-1), no explicit installation needed. - **Pester 5.7.1** - Pre-installed on GitHub-hosted runners, no explicit installation needed. --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Bill Berry <[email protected]>
1 parent de43e73 commit 085a38b

2 files changed

Lines changed: 96 additions & 1 deletion

File tree

.github/copilot-instructions.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,35 @@ All tracking files use markdown format with frontmatter and follow patterns from
9191
* Scripts follow instructions provided by the codebase for convention and standards.
9292
* Scripts used by the codebase have an `npm run` script for ease of use.
9393

94-
PowerShell scripts follow PSScriptAnalyzer rules from `PSScriptAnalyzer.psd1` and include proper comment-based help. Validation runs via `npm run psscriptanalyzer` with results output to `logs/`.
94+
PowerShell scripts follow PSScriptAnalyzer rules from `PSScriptAnalyzer.psd1` and include proper comment-based help. Validation runs via `npm run lint:ps` with results output to `logs/`.
9595
<!-- </script-operations> -->
96+
97+
<!-- <coding-agent-environment> -->
98+
## Coding Agent Environment
99+
100+
Copilot Coding Agent uses a cloud-based GitHub Actions environment, separate from the local devcontainer. The `.github/workflows/copilot-setup-steps.yml` workflow pre-installs tools to match devcontainer capabilities.
101+
102+
### Pre-installed Tools
103+
104+
* Node.js 20 with npm dependencies from `package.json`
105+
* Python 3.11
106+
* PowerShell 7 with Pester 5.7.1 and PowerShell-Yaml modules
107+
* shellcheck for bash script validation (pre-installed on ubuntu-latest)
108+
109+
### Using npm Scripts
110+
111+
Agents should use npm scripts for all validation:
112+
113+
* `npm run lint:md` - Markdown linting
114+
* `npm run lint:ps` - PowerShell analysis
115+
* `npm run lint:yaml` - YAML validation
116+
* `npm run lint:frontmatter` - Frontmatter validation
117+
* `npm run lint:all` - Run all linters
118+
* `npm run test:ps` - PowerShell tests
119+
120+
### Environment Synchronization
121+
122+
The `copilot-setup-steps.yml` mirrors tools from `.devcontainer/scripts/on-create.sh` and `.devcontainer/scripts/post-create.sh`. When adding tools to the devcontainer, update the setup workflow to maintain parity.
123+
<!-- </coding-agent-environment> -->
124+
125+
🤖 Crafted with precision by ✨Copilot following brilliant human instruction, then carefully refined by our team of discerning human reviewers.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
3+
#
4+
# copilot-setup-steps.yml
5+
# Pre-install tools and dependencies for GitHub Copilot Coding Agent
6+
# Reference: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
7+
8+
name: "Copilot Setup Steps"
9+
10+
# Auto-run on push/PR to validate the setup workflow
11+
on:
12+
workflow_dispatch:
13+
push:
14+
paths:
15+
- .github/workflows/copilot-setup-steps.yml
16+
pull_request:
17+
paths:
18+
- .github/workflows/copilot-setup-steps.yml
19+
20+
jobs:
21+
# Job MUST be named 'copilot-setup-steps' to be recognized by Copilot
22+
copilot-setup-steps:
23+
runs-on: ubuntu-latest
24+
25+
# Minimal permissions; Copilot receives its own token for operations
26+
permissions:
27+
contents: read
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
32+
with:
33+
persist-credentials: false
34+
35+
- name: Set up Node.js
36+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
37+
with:
38+
node-version: "20"
39+
cache: "npm"
40+
41+
- name: Install JavaScript dependencies
42+
run: npm ci
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
46+
with:
47+
python-version: "3.11"
48+
49+
- name: Install PowerShell modules
50+
shell: pwsh
51+
run: |
52+
Install-Module -Name PowerShell-Yaml -Force -Scope CurrentUser
53+
Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser
54+
55+
- name: Verify tool availability
56+
run: |
57+
echo "=== Tool Versions ==="
58+
node --version
59+
npm --version
60+
python3 --version
61+
pwsh --version
62+
shellcheck --version
63+
echo ""
64+
echo "=== npm Scripts Available ==="
65+
npm run --list

0 commit comments

Comments
 (0)