You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a few days ago, I've been working in a script automation that uses the go-githhub library (btw that is awsome!). One of the steps was create a Pull request from a fork. Not a personal one, but from the same ownership from upstream repository. However it was there that I through by a problematic question because my branch from this fork couldn't be found anyway.
The struct using to the method can be found with these fields:
struct:
// NewPullRequest represents a new pull request to be created.
type NewPullRequest struct {
Title *string `json:"title,omitempty"`
Head *string `json:"head,omitempty"`
Base *string `json:"base,omitempty"`
Body *string `json:"body,omitempty"`
Issue *int `json:"issue,omitempty"`
MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"`
Draft *bool `json:"draft,omitempty"`
}
And I always receive the response 422: Unprocessable Entity pointing Head value as Invalid Message. With some research the possibilites were that the path was not well formed or the brach couldn't be reached.
So, reading Create method from github api documentation I could notice that field head_repo and its doc says: The name of the repository where the changes in the pull request were made. This field is required for cross-repository pull requests if both repositories are owned by the same organization.
So I thought: "This is exactly that I need". I create a new method calling a http post request by hand. The json body was adjusted to receive:
head: {branch-path}
head_repo: {owner}/{forked-repository-name}
And worked not using go-github library.
Then, after all of this, I forked go-github to try this change adding this field found in github api documentation in PullRequest structure to pass these values and guess what? - It worked again!
I create a pull request that add this field for review. :)
The text was updated successfully, but these errors were encountered:
r-aramizu
changed the title
Missing field important to find branch in fork from same owner
Missing field important to find branch in fork from same organization
Aug 15, 2023
r-aramizu
changed the title
Missing field important to find branch in fork from same organization
Missing important field to find branch in fork from same organization
Aug 16, 2023
gmlewis
pushed a commit
to gmlewis/go-github
that referenced
this issue
Sep 19, 2023
Hi everyone!
In a few days ago, I've been working in a script automation that uses the go-githhub library (btw that is awsome!). One of the steps was create a Pull request from a fork. Not a personal one, but from the same ownership from upstream repository. However it was there that I through by a problematic question because my branch from this fork couldn't be found anyway.
The struct using to the method can be found with these fields:
// NewPullRequest represents a new pull request to be created.
// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#create-a-pull-request
func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error)
I tried mount the branch path to pass in Head field with some variation like:
And I always receive the response 422: Unprocessable Entity pointing Head value as Invalid Message. With some research the possibilites were that the path was not well formed or the brach couldn't be reached.
So, reading Create method from github api documentation I could notice that field head_repo and its doc says: The name of the repository where the changes in the pull request were made. This field is required for cross-repository pull requests if both repositories are owned by the same organization.
So I thought: "This is exactly that I need". I create a new method calling a http post request by hand. The json body was adjusted to receive:
And worked not using go-github library.
Then, after all of this, I forked go-github to try this change adding this field found in github api documentation in PullRequest structure to pass these values and guess what? - It worked again!
I create a pull request that add this field for review. :)
The text was updated successfully, but these errors were encountered: