Move roles from top-level frontmatter to on.roles#16606
Move roles from top-level frontmatter to on.roles#16606
roles from top-level frontmatter to on.roles#16606Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot remove top level field "on" since we have a codemod to fix workflows. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
roles from top-level frontmatter to on.roles
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot keep working |
All work is complete. The PR successfully:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot the code mode should move all the values |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed. The codemod now properly indents multiline role arrays with 4 spaces (nested under both Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Removed duplicate roles from the release workflow configuration.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done. Recompiled all workflows successfully. Updated 4 lock files (ai-moderator, q, release, scout) to include Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR completes the migration of the roles frontmatter field from top-level to on.roles, removing all backward compatibility. Users must now specify role-based access control within the on: section of frontmatter, and a codemod is provided for automatic migration via gh aw fix.
Changes:
- Removed top-level
rolesfrom schema and extraction logic (breaking change - no backward compatibility) - Added
on.rolesto schema and updated extraction logic to only checkon.roles - Created codemod for automatic migration with proper indentation handling for both single-line and multi-line arrays
- Updated all tests, documentation, example workflows, and lock files to reflect the new
on.rolesstructure
Reviewed changes
Copilot reviewed 19 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/parser/schemas/main_workflow_schema.json | Moved roles definition from top-level to on section properties |
| pkg/workflow/role_checks.go | Removed backward compatibility for top-level roles; now only checks on.roles |
| pkg/workflow/extract_roles_test.go | New test file verifying on.roles extraction and confirming top-level roles returns defaults |
| pkg/workflow/skip_roles_test.go | Updated test frontmatter to use on.roles instead of top-level |
| pkg/workflow/role_checks_test.go | Updated test frontmatter to use on.roles instead of top-level |
| pkg/workflow/bots_test.go | Updated test frontmatter to use on.roles instead of top-level |
| pkg/cli/fix_codemods.go | Registered new getRolesToOnRolesCodemod() in codemod list |
| pkg/cli/codemod_roles.go | New codemod implementing migration from top-level roles to on.roles with proper indentation |
| pkg/cli/codemod_roles_test.go | Comprehensive tests for codemod covering single-line arrays, multi-line arrays, and all value |
| docs/src/content/docs/reference/frontmatter.md | Updated documentation to show on.roles with migration note |
| docs/src/content/docs/reference/frontmatter-full.md | Removed top-level roles from full frontmatter reference |
| docs/src/content/docs/patterns/dispatchops.md | Updated example to use on.roles |
| .github/workflows/scout.md | Migrated from top-level to on.roles: [admin, maintainer, write] |
| .github/workflows/scout.lock.yml | Recompiled with on.roles array in generated YAML |
| .github/workflows/release.md | Migrated from top-level to multi-line on.roles array |
| .github/workflows/release.lock.yml | Recompiled with on.roles array in generated YAML |
| .github/workflows/q.md | Migrated from top-level to on.roles: [admin, maintainer, write] |
| .github/workflows/q.lock.yml | Recompiled with on.roles array in generated YAML |
| .github/workflows/poem-bot.md | Migrated from top-level to multi-line on.roles array |
| .github/workflows/poem-bot.lock.yml | Recompiled with on.roles array in generated YAML |
| .github/workflows/ai-moderator.md | Migrated from top-level to on.roles: all |
| .github/workflows/ai-moderator.lock.yml | Recompiled with on.roles: all in generated YAML |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot merge main fix syntax issue |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed. Updated 20+ test cases across 11 test files to use
Main branch was already merged (14162b8). Fixed all syntax issues by updating test files to use Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
The test failure in that CI run was from commit 14162b8 (merge commit, before my fix). My commit 9fede4e already fixed all test files to use Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Move
rolesfrom top-level frontmatter toon.rolesSummary
Successfully migrated the
rolesfrontmatter field from top-level toon.roles. Top-levelrolesis no longer supported - users must migrate using the codemod.Changes Completed
rolesfrom schema (no longer valid)extractRoles()gh aw fixKey Features
roleswill cause validation errorsgh aw fixcommand automatically migrates workflows toon.roleswith correct indentationon:sectionCodemod Fix
The codemod now correctly handles multiline role arrays:
on:, 2 more underroles:)allvalueTest Files Updated
Fixed 20+ test cases across 9 test files to use
on.roles:Files Changed
pkg/parser/schemas/main_workflow_schema.json(removed top-level roles)pkg/workflow/role_checks.go(removed fallback logic, fixed hasSafeEventsOnly)pkg/cli/codemod_roles.go(fixed indentation for multiline arrays)docs/src/content/docs/reference/frontmatter.md,frontmatter-full.mdMigration Instructions
Users must migrate their workflows by running:
Workflows with top-level
roleswill fail validation until migrated.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.