Describe the feature or problem you’d like to solve
gh pr create -H user:branch is limited to creating cross repo pull requests between an upstream repository and a user-owned fork due to createPullRequest mutation limitation in the headRefName field. Instead, these types of cross repo pull requests should specify the GraphQL ID of the upstream repository using headRepositoryId field.
Ideally, the -H, --head branch flag could be used with user or organization logins.
For more information, #9364 (comment)
Proposed solution
This would support intra-organization forking needs as well as simplify acceptance tests around this scenario:
|
# Create the PR spanning upstream and fork repositories, gh pr create does not support headRepositoryId needed for private forks |
|
exec gh api graphql -F repositoryId="${REPO_ID}" -F headRepositoryId="${FORK_ID}" -F query='mutation CreatePullRequest($headRepositoryId: ID!, $repositoryId: ID!) { createPullRequest(input:{ baseRefName: "main", body: "Feature Body", draft: false, headRefName: "feature-branch", headRepositoryId: $headRepositoryId, repositoryId: $repositoryId, title:"Feature Title" }){ pullRequest{ id url } } }' |
Additional context
Relates #9208
Relates #575
Describe the feature or problem you’d like to solve
gh pr create -H user:branchis limited to creating cross repo pull requests between an upstream repository and a user-owned fork due tocreatePullRequestmutation limitation in theheadRefNamefield. Instead, these types of cross repo pull requests should specify the GraphQL ID of the upstream repository usingheadRepositoryIdfield.Ideally, the
-H, --head branchflag could be used with user or organization logins.For more information, #9364 (comment)
Proposed solution
This would support intra-organization forking needs as well as simplify acceptance tests around this scenario:
cli/acceptance/testdata/pr/pr-view-status-respects-branch-pushremote.txtar
Lines 35 to 36 in f85cf1d
Additional context
Relates #9208
Relates #575