-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add support for changing base branch on pull requests #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I might be way off base, but is |
I see what you did there 😏 The other option is to add I gotta say, design decisions like this in the GitHub API drive me absolutely insane. it would have been a simple matter to have the payload for updating a pull request be: {
"title": "Amazing new feature",
"body": "Please pull this in!",
"head": "octocat:new-feature",
"base": {
"ref: "master"
}
} And then it would have been compatible with the existing Pull Request JSON object. Come to think of it, why doesn't GitHub simply accept both styles? (Maybe it does? I haven't tried it) |
If you think so, it might be worth to send [email protected] an email with that question/suggestion. In my experience, they do a good job of either elaborating on their rationale for an API decision, or taking feedback into account and improving it. At least while the API is in preview period and they're purposefully asking for feedback on it:
|
How this issue going? Is it still have to be done? |
@willnorris @shurcooL is this still have to be done? |
As far as I can tell, this issue is unresolved and needs to be done. Latest status appears to be #421 (comment). |
I've sent a request to GitHub Tech Support and will update this thread with their response. |
I had an exchange with the excellent GitHub Tech Support team, and they pointed out that the PATCH API to update a PR never supported the sending of a JSON object representing a PullRequest, which may or may not be an obvious statement to others reading this thread. I did some digging, and that is indeed the case. Unfortunately, they are not amenable to supporting the use case of the above recommendation. My recommendation is that we break the Thoughts? |
what about leaving pulls.Edit as it is today, and have it continue taking a PullRequest as input, but internally it converts it to a type pullRequestUpdate struct {
Title *string `json:"title,omitempty"`
Body *string `json:"body,omitempty"`
State *string `json:"state,omitempty"`
Base *string `json:"base,omitempty"`
} or whatever we name it. Basically, just copy over Title, Body, and State as-is, and copy Base from the passed-in |
Thank you for doing that work @gmlewis!
So something like I'd be in agreement with doing that. We often start out trying to reuse the same struct for get and edit operations, but later find out they're not really compatible (e.g., when editing a pull request, most fields of @willnorris's suggestion works too. We can do that first, for now, since it's less expensive (no public API change), and we can consider/defer the |
I agree. Let's do @willnorris' suggestion above. |
I'm not sure if I understand @willnorris's suggestion completely. But I'd like to work on this. 🙂 |
@sahildua2305, an example of what I think his suggestion was is similar to |
Yes, that was the example I was thinking about. |
As per the discussion in google#421, the PullRequest parameter is converted into an unexported type pullRequestUpdate which matches the shape expected by the pulls PATCH endpoint. Resolves google#421.
announcement: https://developer.github.com/changes/2016-08-23-change-base/
This is going to be problematic since
PullRequestsService.Edit
takes aPullRequest
whose currentbase
field is of typePullRequestBranch
.The text was updated successfully, but these errors were encountered: