Skip to content

Commit 4a1da29

Browse files
authored
Merge pull request #97 from lightspeedwp/claude/audit-labeling-agent-01R4aYFhW6ke7EQy1U45QrzT
PR: Audit and Align Labeling Agent & Workflow Automation with Org Standards
2 parents fc6a646 + b9f74ea commit 4a1da29

20 files changed

+6426
-190
lines changed

.github/AUTOMATION_GOVERNANCE.md

Lines changed: 375 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,375 @@
1+
---
2+
title: "Automation Governance"
3+
version: "v1.0.0"
4+
last_updated: "2025-11-17"
5+
author: "LightSpeed WP Team"
6+
description: "Governance policies for GitHub automation, agents, and labeling workflows"
7+
tags: ["governance", "automation", "labels", "workflows", "agents"]
8+
---
9+
10+
# LightSpeed Automation Governance
11+
12+
This document defines the governance policies, standards, and procedures for GitHub automation across LightSpeed projects, with a focus on labeling agents, workflows, and configuration management.
13+
14+
---
15+
16+
## 1. Purpose & Scope
17+
18+
### Purpose
19+
- Ensure consistency and quality in automation across all LightSpeed repositories
20+
- Define clear ownership and approval processes for automation changes
21+
- Establish standards for creating, maintaining, and deprecating automation
22+
23+
### Scope
24+
This governance applies to:
25+
- GitHub Actions workflows
26+
- Labeling agents and automation
27+
- Configuration files (labels.yml, labeler.yml, issue-types.yml)
28+
- Custom scripts and utilities in `.github/`
29+
- Reusable workflows and actions
30+
31+
---
32+
33+
## 2. Label Governance
34+
35+
### 2.1 Canonical Label Set
36+
37+
**Ownership:** Platform Team
38+
**Location:** `.github/automation/labels.yml`
39+
40+
#### Adding New Labels
41+
42+
**Requirements:**
43+
1. **Justification:** Document why the label is needed
44+
2. **Category:** Assign to appropriate category (status, priority, type, area, etc.)
45+
3. **Naming Convention:** Follow `category:name` format (e.g., `status:in-progress`)
46+
4. **Color Coding:** Use category-appropriate colors (defined below)
47+
5. **Description:** Provide clear, concise description
48+
49+
**Color Standards:**
50+
- **Status:** Blue tones (`BFD4F2`, `C5DEF5`, `1D76DB`)
51+
- **Priority:** Red/Orange gradient (`B60205` critical → `C2E0C6` minor)
52+
- **Type:** Green for features (`3FB950`), Red for bugs (`9F3734`), Purple for docs (`D4C5F9`)
53+
- **Area/Component:** Light blue (`C5DEF5`)
54+
- **Meta:** Grey (`E1E4E8`)
55+
56+
**Approval Process:**
57+
1. Create PR with label addition to `labels.yml`
58+
2. Document use case in PR description
59+
3. Require approval from 2 Platform Team members
60+
4. Label takes effect on next label-sync workflow run
61+
62+
#### Deprecating Labels
63+
64+
**Process:**
65+
1. Add label to deprecation list with replacement (if any)
66+
2. Add alias mapping old → new label in `labels.yml`
67+
3. Run migration script to update existing issues/PRs
68+
4. After 30-day grace period, remove deprecated label
69+
70+
**Example:**
71+
```yaml
72+
- name: status:in-progress
73+
aliases: ['in progress', 'wip', 'status:wip'] # Deprecated aliases
74+
```
75+
76+
### 2.2 Repository-Specific Labels
77+
78+
Repositories may have specific labels not in the canonical set.
79+
80+
**Allowed:**
81+
- Component-specific areas (e.g., `comp:custom-block`)
82+
- Project-specific contexts (e.g., `project:migration-2024`)
83+
- Temporary labels for initiatives (prefix with `temp:`)
84+
85+
**Not Allowed:**
86+
- Alternative status/priority/type labels
87+
- Labels that conflict with canonical naming
88+
89+
**Documentation:**
90+
Repository-specific labels must be documented in the repository's README.
91+
92+
---
93+
94+
## 3. Workflow Governance
95+
96+
### 3.1 Workflow Approval
97+
98+
**Standard Workflows (require Platform Team approval):**
99+
- Labeling workflows
100+
- Label sync workflows
101+
- Security scanning
102+
- Dependency management
103+
- Release automation
104+
105+
**Repository-Specific Workflows (require Maintainer approval):**
106+
- Build/test workflows
107+
- Deployment workflows
108+
- Custom automation
109+
110+
### 3.2 Workflow Standards
111+
112+
All workflows must:
113+
1. **Include skip condition:** Support `[skip workflow-name]` in commit messages
114+
2. **Have concurrency control:** Prevent overlapping runs where appropriate
115+
3. **Use semantic names:** Clear, descriptive names (e.g., `Labeling • Issues & PRs`)
116+
4. **Set appropriate permissions:** Minimal required permissions only
117+
5. **Include failure handling:** Appropriate `continue-on-error` or `if: failure()`
118+
6. **Generate summaries:** Use `$GITHUB_STEP_SUMMARY` for output
119+
7. **Follow UK English:** All text, comments, and documentation
120+
121+
### 3.3 Secrets Management
122+
123+
**Prohibited:**
124+
- Hardcoded credentials in workflows
125+
- Secrets in public repositories
126+
- Sharing secrets across unrelated workflows
127+
128+
**Required:**
129+
- Use GitHub Secrets or environment secrets
130+
- Document required secrets in workflow README
131+
- Rotate secrets quarterly
132+
- Use least-privilege principle
133+
134+
---
135+
136+
## 4. Agent Governance
137+
138+
### 4.1 Agent Development Standards
139+
140+
**Location:** `.github/agents/`
141+
**Includes:** `.github/agents/includes/`
142+
**Tests:** `.github/agents/includes/__tests__/`
143+
144+
**Requirements:**
145+
1. **Modular Design:** Agents orchestrate; utilities implement logic
146+
2. **Configuration-Driven:** No hardcoded values; use YAML configs
147+
3. **Test Coverage:** Minimum 80% coverage for new utilities
148+
4. **Error Handling:** Comprehensive error handling with retry logic
149+
5. **Logging:** Use `@actions/core` for consistent logging
150+
6. **Documentation:** JSDoc for all functions, README for agents
151+
152+
### 4.2 Agent Deployment
153+
154+
**Deployment Process:**
155+
1. Develop in feature branch
156+
2. Add/update tests
157+
3. Update documentation
158+
4. Create PR with `type:automation` label
159+
5. Require 2 Platform Team approvals
160+
6. Test in sandbox repository (if available)
161+
7. Deploy to production via merge
162+
163+
**Rollback Procedure:**
164+
1. Revert PR if critical issues detected
165+
2. Create hotfix for critical bugs
166+
3. Document incident in post-mortem
167+
168+
---
169+
170+
## 5. Configuration Management
171+
172+
### 5.1 Configuration Files
173+
174+
**Canonical Configurations:**
175+
| File | Purpose | Owner | Approval Required |
176+
|------|---------|-------|-------------------|
177+
| `labels.yml` | Label definitions | Platform Team | 2 approvals |
178+
| `labeler.yml` | File/branch-based label rules | Platform Team | 2 approvals |
179+
| `issue-types.yml` | Issue type definitions | Platform Team | 2 approvals |
180+
181+
### 5.2 Validation
182+
183+
**Pre-commit:**
184+
- YAML syntax validation
185+
- Schema validation (via `yaml-validator.js`)
186+
- Referential integrity (labels in templates exist in `labels.yml`)
187+
188+
**CI Validation:**
189+
- All PRs touching config files trigger validation workflow
190+
- Failed validation blocks merge
191+
192+
**Post-deployment:**
193+
- `label-sync` workflow validates and syncs across repositories
194+
- Orphan label detection creates issues for review
195+
196+
---
197+
198+
## 6. Change Management
199+
200+
### 6.1 Change Categories
201+
202+
**Minor Changes (Single Approver):**
203+
- Label description updates
204+
- Color adjustments
205+
- Documentation improvements
206+
- Bug fixes in non-critical paths
207+
208+
**Major Changes (Platform Team Approval):**
209+
- New label categories
210+
- Workflow logic changes
211+
- Breaking changes to automation
212+
- Schema changes
213+
214+
**Emergency Changes (Post-approval):**
215+
- Security fixes
216+
- Critical bug fixes affecting production
217+
- Require post-merge review within 24 hours
218+
219+
### 6.2 Communication
220+
221+
**Required Notifications:**
222+
- **Slack:** #platform channel for all automation changes
223+
- **GitHub Discussions:** Major changes with community impact
224+
- **Release Notes:** Document in CHANGELOG.md
225+
226+
---
227+
228+
## 7. Quality & Compliance
229+
230+
### 7.1 Quality Gates
231+
232+
**Pre-merge:**
233+
- ✅ All tests pass
234+
- ✅ Lint checks pass
235+
- ✅ YAML validation passes
236+
- ✅ Required approvals obtained
237+
- ✅ Documentation updated
238+
239+
**Post-merge:**
240+
- ✅ Automation runs successfully in production
241+
- ✅ No increase in error rates
242+
- ✅ Performance metrics within acceptable range
243+
244+
### 7.2 Monitoring
245+
246+
**Tracked Metrics:**
247+
- Workflow success/failure rates
248+
- Agent execution time
249+
- Label drift (repositories with orphan labels)
250+
- Configuration validation failures
251+
252+
**Review Cadence:**
253+
- Weekly: Review failed workflow runs
254+
- Monthly: Review agent performance
255+
- Quarterly: Audit label usage and cleanup
256+
257+
---
258+
259+
## 8. Training & Onboarding
260+
261+
### 8.1 Required Knowledge
262+
263+
**For Contributors:**
264+
- GitHub Actions basics
265+
- YAML syntax
266+
- Label taxonomy and categories
267+
- How to use labeling agent
268+
269+
**For Maintainers:**
270+
- Agent architecture
271+
- Configuration management
272+
- Workflow debugging
273+
- Incident response
274+
275+
### 8.2 Resources
276+
277+
- **Documentation:** [docs/LABELING_AGENT_USAGE.md](../docs/LABELING_AGENT_USAGE.md)
278+
- **Agent Spec:** [.github/agents/labeling.agent.md](.github/agents/labeling.agent.md)
279+
- **Label Strategy:** [docs/LABEL_STRATEGY.md](../docs/LABEL_STRATEGY.md)
280+
- **Coding Standards:** [.github/instructions/coding-standards.instructions.md](.github/instructions/coding-standards.instructions.md)
281+
282+
---
283+
284+
## 9. Incident Management
285+
286+
### 9.1 Incident Classification
287+
288+
**Severity Levels:**
289+
- **P0 (Critical):** Automation blocking all PRs/issues
290+
- **P1 (High):** Incorrect labels applied at scale
291+
- **P2 (Medium):** Workflow failures, degraded functionality
292+
- **P3 (Low):** Minor bugs, cosmetic issues
293+
294+
### 9.2 Response Procedures
295+
296+
**P0/P1 Incidents:**
297+
1. Immediately disable affected workflow if needed
298+
2. Notify Platform Team in #platform-alerts
299+
3. Create incident issue with `priority:critical`
300+
4. Investigate and implement hotfix
301+
5. Document in post-mortem
302+
303+
**P2/P3 Incidents:**
304+
1. Create issue with appropriate priority
305+
2. Assign to next sprint or backlog
306+
3. Fix via standard PR process
307+
308+
---
309+
310+
## 10. Deprecation & Retirement
311+
312+
### 10.1 Deprecation Process
313+
314+
**For Workflows:**
315+
1. Add deprecation notice to workflow documentation
316+
2. Set 90-day deprecation period
317+
3. Create migration guide
318+
4. Notify users via GitHub Discussions
319+
5. Disable workflow after grace period
320+
6. Archive workflow file
321+
322+
**For Labels:**
323+
1. Add to deprecation list with replacement
324+
2. Add alias mapping
325+
3. Run migration across repositories
326+
4. 30-day grace period
327+
5. Remove label from canonical set
328+
329+
---
330+
331+
## 11. Contacts & Escalation
332+
333+
**Platform Team:**
334+
- Primary contact for automation issues
335+
- Approvers for major changes
336+
- Incident response team
337+
338+
**Escalation Path:**
339+
1. Create issue in `.github` repository
340+
2. Mention `@platform-team` for urgent issues
341+
3. Use `#platform` Slack channel for real-time help
342+
4. Email [email protected] for critical issues
343+
344+
---
345+
346+
## 12. Review & Updates
347+
348+
**This document is reviewed:**
349+
- Quarterly by Platform Team
350+
- After major incidents
351+
- When significant automation changes are proposed
352+
353+
**Version History:**
354+
- v1.0.0 (2025-11-17): Initial version
355+
356+
---
357+
358+
## Appendix A: Label Categories Reference
359+
360+
| Category | Prefix | Example | Purpose |
361+
|----------|--------|---------|---------|
362+
| Status | `status:` | `status:in-progress` | Workflow state |
363+
| Priority | `priority:` | `priority:high` | Urgency level |
364+
| Type | `type:` | `type:bug` | Nature of work |
365+
| Area | `area:` | `area:core` | Codebase area |
366+
| Component | `comp:` | `comp:block-editor` | Specific component |
367+
| Language | `lang:` | `lang:php` | Programming language |
368+
| Meta | `meta:` | `meta:needs-changelog` | Process/admin |
369+
| Contributor | `contrib:` | `contrib:good-first-issue` | Community labels |
370+
| Discussion | `discussion:` | `discussion:feedback` | Discussion categories |
371+
| Release | `release:` | `release:patch` | Release type |
372+
373+
---
374+
375+
_For questions about this governance document, create an issue in the [`.github` repository](https://github.com/lightspeedwp/.github/issues) or contact the Platform Team._

0 commit comments

Comments
 (0)