1+ name : Copilot Configuration Validation
2+
3+ on :
4+ push :
5+ branches : [ "main", "develop" ]
6+ paths :
7+ - ' .github/copilot-instructions.md'
8+ - ' .copilot/**'
9+ - ' .github/copilot-mcp.json'
10+ pull_request :
11+ branches : [ "main" ]
12+ paths :
13+ - ' .github/copilot-instructions.md'
14+ - ' .copilot/**'
15+ - ' .github/copilot-mcp.json'
16+
17+ jobs :
18+ validate-copilot-config :
19+ runs-on : ubuntu-latest
20+ name : Validate Copilot Configuration
21+
22+ steps :
23+ - name : Checkout
24+ uses : actions/checkout@v4
25+
26+ - name : Setup Node.js
27+ uses : actions/setup-node@v4
28+ with :
29+ node-version : 20
30+ cache : ' npm'
31+
32+ - name : Install dependencies
33+ run : npm ci
34+
35+ - name : Validate configuration files exist
36+ run : |
37+ echo "Checking for required Copilot configuration files..."
38+
39+ # Check for repository instructions
40+ if [ ! -f ".github/copilot-instructions.md" ]; then
41+ echo "❌ Missing .github/copilot-instructions.md"
42+ exit 1
43+ else
44+ echo "✅ Found .github/copilot-instructions.md"
45+ fi
46+
47+ # Check for custom instructions
48+ if [ ! -f ".copilot/instructions.md" ]; then
49+ echo "❌ Missing .copilot/instructions.md"
50+ exit 1
51+ else
52+ echo "✅ Found .copilot/instructions.md"
53+ fi
54+
55+ # Check for development environment config
56+ if [ ! -f ".copilot/dev-environment.yml" ]; then
57+ echo "❌ Missing .copilot/dev-environment.yml"
58+ exit 1
59+ else
60+ echo "✅ Found .copilot/dev-environment.yml"
61+ fi
62+
63+ # Check for MCP configuration
64+ if [ ! -f ".github/copilot-mcp.json" ]; then
65+ echo "❌ Missing .github/copilot-mcp.json"
66+ exit 1
67+ else
68+ echo "✅ Found .github/copilot-mcp.json"
69+ fi
70+
71+ - name : Validate JSON configuration files
72+ run : |
73+ echo "Validating JSON configuration files..."
74+
75+ # Validate MCP configuration JSON
76+ if ! jq . .github/copilot-mcp.json > /dev/null; then
77+ echo "❌ Invalid JSON in .github/copilot-mcp.json"
78+ exit 1
79+ else
80+ echo "✅ Valid JSON in .github/copilot-mcp.json"
81+ fi
82+
83+ - name : Validate YAML configuration files
84+ run : |
85+ echo "Validating YAML configuration files..."
86+
87+ # Install yq for YAML validation (Python version via pip)
88+ sudo apt-get update
89+ sudo apt-get install -y python3-pip
90+ pip3 install --user yq
91+ export PATH="$HOME/.local/bin:$PATH"
92+
93+ # Validate development environment YAML
94+ if ! yq eval . .copilot/dev-environment.yml > /dev/null; then
95+ echo "❌ Invalid YAML in .copilot/dev-environment.yml"
96+ exit 1
97+ else
98+ echo "✅ Valid YAML in .copilot/dev-environment.yml"
99+ fi
100+
101+ - name : Validate project still builds
102+ run : |
103+ echo "Ensuring project builds successfully with current configuration..."
104+ npm run build
105+
106+ - name : Validate linting passes
107+ run : |
108+ echo "Ensuring linting passes with current configuration..."
109+ npm run lint
110+
111+ - name : Check configuration completeness
112+ run : |
113+ echo "Checking configuration completeness..."
114+
115+ # Check if copilot-instructions.md contains required sections
116+ if ! grep -q "## Project Overview" .github/copilot-instructions.md; then
117+ echo "❌ Missing Project Overview section in copilot-instructions.md"
118+ exit 1
119+ fi
120+
121+ if ! grep -q "Technology Stack" .github/copilot-instructions.md; then
122+ echo "❌ Missing Technology Stack section in copilot-instructions.md"
123+ exit 1
124+ fi
125+
126+ if ! grep -q "Development Guidelines" .github/copilot-instructions.md; then
127+ echo "❌ Missing Development Guidelines section in copilot-instructions.md"
128+ exit 1
129+ fi
130+
131+ # Check if custom instructions contain key principles
132+ if ! grep -q "Design Engineering Principles" .copilot/instructions.md; then
133+ echo "❌ Missing Design Engineering Principles in .copilot/instructions.md"
134+ exit 1
135+ fi
136+
137+ if ! grep -q "Technology Preferences" .copilot/instructions.md; then
138+ echo "❌ Missing Technology Preferences in .copilot/instructions.md"
139+ exit 1
140+ fi
141+
142+ # Check if MCP config has required structure
143+ if ! jq -e '.mcp.servers' .github/copilot-mcp.json > /dev/null; then
144+ echo "❌ Missing MCP servers configuration"
145+ exit 1
146+ fi
147+
148+ if ! jq -e '.context' .github/copilot-mcp.json > /dev/null; then
149+ echo "❌ Missing context configuration in MCP"
150+ exit 1
151+ fi
152+
153+ echo "✅ All configuration completeness checks passed"
154+
155+ - name : Report validation success
156+ run : |
157+ echo "🎉 All Copilot configuration validation checks passed!"
158+ echo "The repository is properly configured for GitHub Copilot coding agent."
0 commit comments