Reuse shared workflow types for Copilot setup scaffolding - #54804
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| "$ref": "#/definitions/permissions-level" | ||
| }, | ||
| "drives": { | ||
| "$ref": "#/definitions/permissions-level" |
There was a problem hiding this comment.
Restored the drives schema permission and merged main in 320f1e7.
There was a problem hiding this comment.
Reverted the stray local edit to pkg/workflow/schemas/github-workflow.json — the branch is already merged with main (370f5c2) and the file now matches main's drives position exactly.
…eplace-duplicate-gha-workflow-model Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff
|
|
✅ Ponytail Reviewer completed successfully! Ponytail review: PR is a pure deduplication refactor (removes duplicate CopilotWorkflowStep/WorkflowJob/Workflow types, reuses shared workflow.WorkflowFile/WorkflowFileJob/WorkflowStep). Net deletion of code, no speculative abstractions or reinvented logic found. Lean already. Ship.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (46 additions detected, threshold is 100).
|
|
🛠️ Agentic Maintenance updated this pull request branch. |
There was a problem hiding this comment.
Pull request overview
Consolidates Copilot setup workflow fixtures around shared pkg/workflow types.
Changes:
- Adds shared workflow-file and job models.
- Replaces CLI-local step models in tests.
- Regenerates command routing with an unrelated
smoke-driveroute.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/workflow_file.go |
Adds shared YAML models. |
pkg/cli/copilot_setup.go |
Removes local duplicate types. |
pkg/cli/copilot_setup_test.go |
Migrates tests to shared types. |
.github/workflows/agentic_commands.yml |
Adds smoke-drive routing. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Balanced
| type WorkflowFile struct { | ||
| Name string `yaml:"name,omitempty"` | ||
| On any `yaml:"on,omitempty"` | ||
| Jobs map[string]WorkflowFileJob `yaml:"jobs,omitempty"` |
| # /smoke-crush -> smoke-crush [issue_comment,issues,pull_request,pull_request_comment] reaction=eyes | ||
| # /smoke-cursor -> smoke-cursor [issue_comment,issues,pull_request,pull_request_comment] reaction=rocket | ||
| # /smoke-deepseek-harness -> smoke-deepseek-harness [issue_comment,issues,pull_request,pull_request_comment] reaction=eyes | ||
| # /smoke-drive -> smoke-drive [issue_comment,issues,pull_request,pull_request_comment] reaction=rocket |
| // WorkflowFileJob represents a GitHub Actions workflow job in a workflow file. | ||
| type WorkflowFileJob struct { | ||
| RunsOn any `yaml:"runs-on,omitempty"` | ||
| Permissions map[string]any `yaml:"permissions,omitempty"` |
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment.
|
There was a problem hiding this comment.
No actionable changed-line issues stood out here. The new shared workflow-file structs match the old copilot setup YAML shape, keep the flexible on/runs-on/permissions typing needed for round-tripping existing workflow files, and the test updates cover the moved types without changing behavior.
🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 18.7 AIC · ⌖ 6.75 AIC · ⊞ 7K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design — one suggestion, otherwise clean consolidation work.
📋 Summary
What this PR does well
- ✅ Clean elimination of duplicate types (
CopilotWorkflowStep,WorkflowJob,Workflow) in favour of sharedpkg/workflowequivalents — reduces the maintenance surface and the risk of the two models diverging. - ✅ Narrowing
Envfrommap[string]any→map[string]stringis the right semantic tightening; the test rename fromTestCopilotWorkflowStepStructure→TestWorkflowStepYAMLStructureandTestWorkflowStructMarshaling→TestWorkflowFileMarshalingimproves clarity. - ✅ New file
pkg/workflow/workflow_file.gois minimal and well-placed.
One suggestion
WorkflowFileJob.Permissions is map[string]any while GitHub Actions permission values are always strings. The PR already applied this tightening to Env — applying it to Permissions too would be consistent. See inline comment.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 33.5 AIC · ⌖ 9.79 AIC · ⊞ 7.6K
Comment /matt to run again
| type WorkflowFileJob struct { | ||
| RunsOn any `yaml:"runs-on,omitempty"` | ||
| Permissions map[string]any `yaml:"permissions,omitempty"` | ||
| Steps []WorkflowStep `yaml:"steps,omitempty"` |
There was a problem hiding this comment.
[/codebase-design] Permissions is typed map[string]any, but GitHub Actions permission values are always strings ("read", "write", "none"). This PR already narrowed Env from map[string]any → map[string]string on WorkflowStep for the same reason — Permissions deserves the same treatment for consistency.
💡 Suggested change
// Before
Permissions map[string]any `yaml:"permissions,omitempty"`
// After
Permissions map[string]string `yaml:"permissions,omitempty"`This keeps the type vocabulary consistent and catches bad permission values at compile time rather than at runtime.
@copilot please address this.
There was a problem hiding this comment.
Replaced Permissions map[string]any with a new WorkflowFilePermissions union type that supports both the scope-map form (contents: read) as map[string]string and the shorthand scalar form (read-all/write-all/none), since a plain map[string]string alone can't represent the scalar permissions case raised in the other thread.
There was a problem hiding this comment.
Clean refactor — no blocking issues found.
The PR removes three locally-defined types (CopilotWorkflowStep, WorkflowJob, Workflow) from copilot_setup.go and replaces them with the shared workflow.WorkflowStep, workflow.WorkflowFileJob, and workflow.WorkflowFile. This reduces duplication and ensures the copilot-setup scaffolding stays in sync with the rest of the compiler's type system.
Notable improvement: Env map[string]any → Env map[string]string. GitHub Actions environment values must be strings, so the tighter type is strictly correct and prevents accidental non-string values.
All test references are updated consistently. LGTM.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 38.9 AIC · ⌖ 9 AIC · ⊞ 6.2K
|
@copilot this PR looks close, but there is still one maintainer-facing follow-up to finish.
Run: https://github.com/github/gh-aw/actions/runs/32578995676
|
|
@gh-aw-bot Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
…cope Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
pr-finisher pass complete:
Still needed: a maintainer re-trigger of CI and final human review/approval before merge. |
Copilot setup scaffolding maintained a separate GitHub Actions workflow, job, and step model in
pkg/cli. This consolidates the model underpkg/workflowand reuses the primaryWorkflowSteptype.Shared workflow-file model
workflow.WorkflowFileandworkflow.WorkflowFileJobfor YAML workflow-file serialization.on,runs-on, and permissions fields required when reading existing workflows.Removed CLI-local duplicates
CopilotWorkflowStep,WorkflowJob, andWorkflowfromcopilot_setup.go.pr-sous-chef run https://github.com/github/gh-aw/actions/runs/32578995676> Generated by 👨🍳 PR Sous Chef · gpt54 · 14.2 AIC · ⌖ 8.25 AIC · ⊞ 9.5K · ◷