Repository navigation
Add reviewers field to create-pull-request safe output - #1981
Conversation
- Added Reviewers field to CreatePullRequestsConfig struct - Updated parsePullRequestsConfig to parse reviewers (supports string or array) - Added reviewer assignment steps in buildCreateOutputPullRequestJob - Checkout step added when reviewers are configured - Using gh pr edit --add-reviewer for each reviewer - Maps "copilot" to "copilot-swe-agent" - Uses pr_url step output for gh pr edit command - Updated JSON schema to include reviewers field - Added comprehensive unit tests for reviewers functionality - Added integration tests for end-to-end compilation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Added reviewers field to create-pull-request configuration examples - Added configuration options section explaining reviewers functionality - Added dedicated section on "Assigning Issues and Pull Requests to Copilot" - Documented special "copilot" value mapping to copilot-swe-agent - Documented authentication requirements for bot reviewers - Added comprehensive examples with PAT configuration Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- All unit tests pass (7 new tests for reviewers) - All integration tests pass (3 new tests) - Linting passes (Go, JavaScript, YAML) - Schema validation passes - Manual compilation verified with multiple examples - agent-finish completes successfully (64 workflows compiled) Implementation complete and ready for review. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Removed all mentions of "copilot-swe-agent" from safe-outputs.md - Updated to refer to "the Copilot bot" or "Copilot" instead - Simplified "How It Works" section to avoid exposing internal implementation - Updated code comments to use "the Copilot bot" phrasing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Agentic Changeset Generator triggered by this pull request. |
| ### How It Works | ||
|
|
||
| When you use `copilot` in the `assignees` or `reviewers` configuration: | ||
|
|
||
| 1. **Automatic Mapping**: The workflow automatically handles the special `copilot` value | ||
| 2. **Step Name**: The generated workflow step shows "copilot" (e.g., "Assign issue to copilot" or "Add copilot as reviewer") | ||
| 3. **Conditional Execution**: Assignment/reviewer steps only run if the issue or pull request was successfully created | ||
|
|
||
| ### Benefits | ||
|
|
||
| - **Automated Review**: Copilot can automatically review pull requests and provide feedback | ||
| - **Issue Analysis**: Copilot can analyze and provide suggestions on assigned issues | ||
| - **Simple Configuration**: Use the friendly `copilot` value for easy setup | ||
| - **Safe Failure**: If assignment fails, the workflow continues (the issue/PR is still created) |
There was a problem hiding this comment.
Removed the "How It Works" and "Benefits" sections. Changes in commit a0c8267.
There was a problem hiding this comment.
Pull Request Overview
Adds reviewer assignment capability to the create-pull-request safe output, mirroring assignee handling for issues.
- Introduces Reviewers field in CreatePullRequestsConfig and parsing logic for string/array formats
- Generates conditional gh CLI steps to add reviewers (supports copilot mapping and token precedence)
- Updates schema and documentation plus adds unit/integration tests
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/create_pull_request.go | Implements reviewers field, step generation, and config parsing |
| pkg/workflow/create_pull_request_reviewers_test.go | Adds unit tests for reviewer parsing and step generation including token precedence |
| pkg/workflow/create_pull_request_reviewers_integration_test.go | Verifies end-to-end compilation with various reviewer configurations |
| pkg/parser/schemas/main_workflow_schema.json | Extends schema to accept reviewers as string or array |
| docs/src/content/docs/reference/safe-outputs.md | Documents new reviewers option and Copilot assignment behavior |
| .github/workflows/dev.lock.yml | Minor permissions ordering change (non-functional) |
| .changeset/patch-add-reviewers-field.md | Records patch changeset metadata |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| steps = append(steps, " run: |\n") | ||
| steps = append(steps, " gh pr edit \"$PR_URL\" --add-reviewer \"$REVIEWER\"\n") | ||
|
|
||
| // Add a comment after each reviewer step except the last |
There was a problem hiding this comment.
[nitpick] The comment claims to add a comment, but the code only inserts a blank newline for formatting. Recommend updating the comment to something like: // Insert a blank line between reviewer steps for readability, or remove the conditional + blank line if not required for YAML clarity.
| // Add a comment after each reviewer step except the last | |
| // Insert a blank line between reviewer steps for readability |
| **Configuration Options:** | ||
| - **`assignees:`** - GitHub username(s) to automatically assign to created issues. Accepts either a single string (`assignees: user1`) or an array of strings (`assignees: [user1, user2]`). The workflow automatically adds steps that call `gh issue edit --add-assignee` for each assignee after the issue is created. Only runs if the issue was successfully created. | ||
| - **Special value**: Use `copilot` to assign to the `copilot-swe-agent` bot | ||
| - **Special value**: Use `copilot` to assign to the Copilot bot |
There was a problem hiding this comment.
[nitpick] This line omits the actual GitHub username mapping used in implementation (copilot-swe-agent). For clarity and consistency with the schema descriptions, update to: Use copilot to assign to the copilot-swe-agent bot (the Copilot reviewer account).
| - **Special value**: Use `copilot` to assign to the Copilot bot | |
| - **Special value**: Use `copilot` to assign to the `copilot-swe-agent` bot (the Copilot reviewer account) |
|
|
||
| **Configuration Options:** | ||
| - **`reviewers:`** - GitHub username(s) to automatically assign as reviewers to the created pull request. Accepts either a single string (`reviewers: user1`) or an array of strings (`reviewers: [user1, user2]`). The workflow automatically adds steps that call `gh pr edit --add-reviewer` for each reviewer after the pull request is created. Only runs if the pull request was successfully created. | ||
| - **Special value**: Use `copilot` to assign the Copilot bot as a reviewer |
There was a problem hiding this comment.
[nitpick] The special value description does not state the actual mapped account (copilot-swe-agent), which may confuse users auditing permissions. Suggest revising line 258 to: Use copilot to assign the copilot-swe-agent bot (Copilot reviewer account).
| - **Special value**: Use `copilot` to assign the Copilot bot as a reviewer | |
| - **Special value**: Use `copilot` to assign the `copilot-swe-agent` bot (Copilot reviewer account) as a reviewer |
| ## Assigning Issues and Pull Requests to Copilot | ||
|
|
||
| Both `create-issue` and `create-pull-request` safe outputs support assigning the created issue or adding reviewers to the pull request using the special value `copilot`. This provides automated code review and issue analysis. | ||
|
|
There was a problem hiding this comment.
[nitpick] This section introduces the copilot special value but does not reiterate the concrete GitHub username (copilot-swe-agent). Adding that mapping here improves discoverability and reduces ambiguity for users verifying organization access controls.
| > **Note:** The special value `copilot` refers to the GitHub user [`copilot-swe-agent`](https://github.com/copilot-swe-agent). Use this mapping to verify organization access controls. |
|
- Removed detailed implementation explanation section - Removed benefits section per feedback - Kept essential usage examples and authentication requirements Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Added reviewers: copilot to 9 agentic workflows using create-pull-request: - daily-doc-updater.md - github-mcp-tools-report.md - poem-bot.md - q.md - security-fix-pr.md - technical-doc-writer.md - tidy.md - unbloat-docs.md - Created test workflows demonstrating reviewers field: - test-claude-create-pull-request-reviewers.md (array format) - test-copilot-create-pull-request-reviewers.md (string format) - Recompiled all workflows to generate updated .lock.yml files - All tests pass Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added
All workflows compiled successfully. Changes in commit 1c8f5e1. |
Add reviewers field to create-pull-request safe output ✅
This PR adds support for automatically assigning reviewers to pull requests created by the
create-pull-requestsafe output, following the exact pattern used for assignees increate-issue.Summary of Changes
1. Code Implementation
Reviewersfield toCreatePullRequestsConfigstructghCLI (only when reviewers configured)gh pr edit --add-reviewercopilot→ internal Copilot bot usernamepr_urlstep output for gh CLI commands2. Schema Updates
main_workflow_schema.jsonto includereviewersfield with proper validation3. Comprehensive Testing
test-claude-create-pull-request-reviewers.md(array format with multiple reviewers)test-copilot-create-pull-request-reviewers.md(string format with single reviewer)4. Production Workflows Updated
reviewers: copilotto 9 agentic workflows that usecreate-pull-request:5. Documentation
Usage Example
Verification
✅ All unit tests pass (7 new tests)
✅ All integration tests pass (3 new tests)
✅ Linting passes (Go, JavaScript, YAML)
✅ Schema validation passes
✅ Manual compilation verified
✅ Recompiled all workflows successfully (66 workflows)
✅ Documentation updated per feedback
✅ Test workflows created
✅ Production workflows updated with copilot reviewer
Files Changed
pkg/workflow/create_pull_request.go- Core implementationpkg/workflow/create_pull_request_reviewers_test.go- Unit testspkg/workflow/create_pull_request_reviewers_integration_test.go- Integration testspkg/parser/schemas/main_workflow_schema.json- Schema updatesdocs/src/content/docs/reference/safe-outputs.md- Documentation.github/workflows/- Added copilot as reviewerpkg/cli/workflows/- Demonstrating the featureReady for review! 🚀
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.