-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support auto_merge
field in PullRequest struct
#1881
Comments
Thank you, @fho ! This would be a great PR for any new contributor to this repo or a new Go developer. Feel free to volunteer for any issue and the issue can be assigned to you so that others don't attempt to duplicate the work. Please check out our CONTRIBUTING.md guide to get started. (In particular, please remember to Thank you! |
Hey @gmlewis, I am new to opensource and Golang, I will like to contribute to this project can you guide me on what needs to be done. |
Hi @slayer321 - welcome to Go and to open source and thank you for your interest in helping out this project! Sure... when attacking any kind of problem, it is best to break it down into smaller, more easily understandable parts. So for this specific task, I would basically do the following:
As an aside, I personally use the following test script so that I don't forget anything: #!/bin/bash -ex
go generate ./...
go test ./...
go vet ./...
$ git checkout -b i1881-support-auto-merge OK, I can see this message is going to get huge... so I'll just start commenting and keep creating more comments as I break down the problem. Stay tuned... 😂 |
OK, I'm getting pulled into a meeting so I'm going to have to continue to address this later today. |
// PullRequestAutoMerge represents the "auto_merge" response for a PullRequest.
type PullRequestAutoMerge struct {
EnabledBy *User `json:"enabled_by,omitempty"`
MergeMethod *string `json:"merge_method,omitempty"`
CommitTitle *string `json:"commit_title,omitempty"`
CommitMessage *string `json:"commit_message,omitempty"`
} Then I would add this new struct into the ...
RequestedReviewers []*User `json:"requested_reviewers,omitempty"`
AutoMerge *PullRequestAutoMerge `json:"auto_merge,omitempty"`
... Afterward, I would ideally incorporate this new value in an existing or new unit test (following examples in the surrounding code)... although it is not always necessary to do this just when adding new fields. It is a nice-to-have to make sure that the struct gets populated properly from JSON... and you could use the example given by the author of the issue in this case. Finally, I would test out all my changes using that same script I shared above and make sure everything is working properly, then I would share my PR on GitHub and ask for a code review. I think that about summarizes things... please let me know if you have any questions, and best wishes to you. |
Wow, I did not expect such a fast response. :-) |
Thank you very much @gmlewis for explaining everything step by step. Most of the steps I understood and some I didn't but I am learning about it. As you have assigned it to me I will start working on it and if I face any problems I will let you know 😃 |
Sorry, @bharathk005 , but let us give @slayer321 an opportunity to respond before taking over an issue that is already assigned. Additionally, I looked at your PR and it has a number of problems, so I'm not going to officially review it until we hear back from @slayer321. As for putting test files in a separate folder, that is not idiomatic Go and we will not accept that kind of change in this repo. |
@gmlewis |
Sorry, @gmlewis for replying so late. I was not able to work on this issue as my college exam started and I was busy with that but now as the exams are over I can start working on it. |
@gmlewis Before opening a PR I have some doubt that I think needs to be clear. I added all the code that needs to be added but I am bit confuse about the testing part.
As you have mentioned above that after adding the fields we need to test the code so I found a file name
seeing this error I think that I need to give the github username is that what's needed? apart from all this I run all the 3 test command and getting no errors
|
Sorry, @slayer321, but it is really difficult to diagnose and troubleshoot problems without seeing the code and seeing the exact command that you are using to run the code. Can you please either create the PR or a GitHub gist that shows what you are trying to do and how you are calling it? Make sure to NOT including any personal access tokens in your post, as you would have to immediately delete them if you do. Thanks. |
Hi @slayer321 - #1896 LGTM... nice job! It sounds like you were having challenges with that testing... feel free to post a GitHub gist (without your personal access token) and I'll see if I can figure out what is going wrong with it. |
Hii @gmlewis , I did the test as I was mention in |
As I commented on the gist, you can ignore the existing integration test. Please attempt to write your own stand-alone test to make sure that the new code works. You don't need to check it in to the repo, but just make sure that it does what you expect. Thank you, @slayer321 ! |
Thanks a lot for the implementation @slayer321. I don't know how you want to handle it, @gmlewis. |
Since #1896 is not yet merged, I'm fine if @slayer321 would like to add it to that PR. |
Hi @gmlewis, yeah I will like to add changes that need to be done.
I found the
is this correct? |
That sounds right to me. @fho - can you please confirm? |
|
Sorry, for the confusion. Please forget what I said. :-) The |
oh! thank you for letting us know. :) |
#1896 is now merged 😁🎉 Thank you @slayer321! @gmlewis when can a release be expected? 😊👍 |
Yes indeed, @simongottschlag , but I've got a lot more merges to perform first. Hopefully by later tonight you will have a new release. |
@gmlewis that's awesome! Sorry if it read like "I expect a release now!" - it was more a question like "How is the usual release cadence? I'm in no hurry, but really looking forward to it!". Thank you for the hard work! 🥇 |
Fixed by #1896. |
No problem at all, @simongottschlag! I was just trying to give an accurate estimate. 😄 This should now be available in Release v37.0.0: https://github.com/google/go-github/releases/tag/v37.0.0 |
The pulls API returns an
auto_merge
field which is currently not available in thePullRequest
struct.When auto-merge is enabled for a Pull-Request the returned
auto_merge
field looks like:It would be great if go-github could parse this field and make it accessible.
The text was updated successfully, but these errors were encountered: