Skip to content

Create pull requests from a uniquely identifiable organization-owned fork #14510

Description

@williammartin

Describe the feature or problem you’d like to solve

Contributors can identify a user-owned fork with --head OWNER:BRANCH, but the same workflow does not support forks owned by organizations. This blocks contributors whose work lives in an organization-owned fork, including forks owned by the same organization as the upstream repository.

As a contributor working from an organization-owned fork, I want to identify the fork by its organization and branch when there is only one possible match, so that I can create a pull request without needing to provide the complete repository name.

Proposed solution

Allow gh pr create --head ORGANIZATION:BRANCH to select an organization-owned head repository when exactly one matching fork can be identified.

Feature: Create a pull request from a uniquely identifiable organization-owned fork

  Scenario: The fork belongs to another organization
    Given the base repository is "org/upstream"
    And "other-org" owns exactly one matching fork
    And the matching fork is "other-org/upstream-fork"
    When the contributor runs `gh pr create --head other-org:feature-branch`
    Then a pull request is created from "other-org/upstream-fork:feature-branch"
    And the pull request targets "org/upstream"

  Scenario: The fork belongs to the same organization as the base repository
    Given the base repository is "org/upstream"
    And "org" owns exactly one matching fork
    And the matching fork is "org/upstream-fork"
    When the contributor runs `gh pr create --head org:feature-branch`
    Then a pull request is created from "org/upstream-fork:feature-branch"
    And the pull request targets "org/upstream"

Additional context

This is a sub-issue of #10093.

This issue covers ORGANIZATION:BRANCH when exactly one matching organization-owned fork can be identified. Selecting among multiple possible forks is covered separately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-prrelating to the gh pr command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions