Skip to content

gh pr create: Reviewers automatically requested on draft #9589

@nessex

Description

@nessex

Describe the bug

In a repository with codeowners, if you use the gh pr create command to create a draft PR, the codeowners will automatically be assigned as reviewers.

When creating the same kind of draft PR in the GitHub UI, the reviewers aren't added until the PR is marked as Ready for review.

Steps to reproduce the behavior

  1. Create / find a repository with CODEOWNERS assigned to a team
  2. Create a commit for changing a file owned by that team
  3. Use gh pr create --title test --body "test" --assignee "@me" --draft to create the PR as a draft
  4. See that reviewers are automatically added at the draft stage

Repeat with a PR created via the GitHub UI and the reviewers will not be assigned when you hit the Create Draft button.

Expected vs actual behavior

Drafts are created without reviewers automatically assigned.
Or optionally: a flag to decide whether to request reviewers automatically.

Logs

Not much to show, it succeeds in creating the PR without any error message etc.

gh pr create --title "${title}" --body "${description}" --assignee "@me" --base master --draft

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmore-info-neededMore info needed from user/contributorneeds-triageneeds to be reviewed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions