Skip to content

fix: apply configured reviewers when creating pull request via safe output#21217

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-create-pr-reviewers
Mar 16, 2026
Merged

fix: apply configured reviewers when creating pull request via safe output#21217
pelikhan merged 3 commits intomainfrom
copilot/fix-create-pr-reviewers

Conversation

Copy link
Contributor

Copilot AI commented Mar 16, 2026

reviewers configured in safe-outputs.create-pull-request were correctly serialized into GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG by the Go compiler but silently ignored by create_pull_request.cjs — the handler never read config.reviewers or called requestReviewers.

Changes

  • create_pull_request.cjs

    • Extract configReviewers from config.reviewers at factory init (same pattern as envLabels)
    • After PR creation and label assignment, call pulls.requestReviewers with configured reviewers
    • Handle copilot reviewer separately, mapping it to copilot-pull-request-reviewer[bot] (mirrors add_reviewer.cjs behavior)
    • Reviewer API errors emit a warning rather than failing the step — PR creation still succeeds
  • create_pull_request.test.cjs — new test suite covering:

    • Regular reviewer list applied to the created PR
    • copilot reviewer triggers a separate requestReviewers call with the bot username
    • No requestReviewers call when no reviewers configured
    • Graceful warning on API failure
    • Comma-separated string parsed the same as an array

Example config that now works end-to-end

safe-outputs:
  create-pull-request:
    draft: false
    labels: [status-update]
    reviewers: [alondahari, copilot]

Copilot AI and others added 2 commits March 16, 2026 11:34
…utput (#682)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review March 16, 2026 12:10
Copilot AI review requested due to automatic review settings March 16, 2026 12:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for applying configured reviewers when creating a pull request via safe output, fixing a bug where the reviewers config was serialized but never read or acted upon.

Changes:

  • Extract and apply configReviewers from config in create_pull_request.cjs, with special handling for the copilot reviewer (mapped to bot username)
  • Add comprehensive test coverage for the new reviewer functionality

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
actions/setup/js/create_pull_request.cjs Add reviewer request logic after PR creation, consistent with add_reviewer.cjs patterns
actions/setup/js/create_pull_request.test.cjs New test suite covering reviewer assignment scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add logging with code.info

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 16, 2026

@copilot add logging with code.info

Added pre-action core.info before each requestReviewers call (e.g. Requesting 2 reviewer(s) for pull request #42: ["user1","user2"]) and kept the post-success info log. Done in 574f9ca.

Copilot AI requested a review from pelikhan March 16, 2026 12:22
@pelikhan pelikhan merged commit 341ee9f into main Mar 16, 2026
51 checks passed
@pelikhan pelikhan deleted the copilot/fix-create-pr-reviewers branch March 16, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create-pull-request safe output does not add reviewers configured in workflow

3 participants