huboard / ghee

This is an unofficial ruby client for the Github API. The end goal is a complete, simple, and intuitive ruby API for all things Github.
http://documentup.com/huboard/ghee
MIT License
160 stars 51 forks source link

[RFE]: Support for pull request comments #14

Closed lzap closed 11 years ago

lzap commented 11 years ago

Hey,

I wonder if it is possible to comment pull requests. I would like to create a bot that would run unit tests and adding results as comments.

Thanks.

rauhryan commented 11 years ago

Yes, it is possible to comment on pull requests.

Pull requests are actually implemented as issues as far as the API is concerned.

So technically you can pull a single pull request.

pull = gh.repos("rauhryan","ghee").pulls(13)

You can actually comment on the pull request by accessing it like an issue

gh.repos("rauhryan", "ghee").issues(pull["number"]).comments.create({:body => "hey i'll help fix that suck"}) 

You bring up a good point that it appears that you can't comment on pull requests. It won't be that hard for me to add comment support to pull requests by delegating it to the issues code in my library.

Thanks a lot! I'll let you know when I add proper support. I hope this helps you in the mean time.

-Ryan

lzap commented 11 years ago

Ah, hmm. I have tried it and github.com is giving me

 {"message"=>"Not Found"}

for some reason. The repo has issues disabled tho. I will try with a repo with issues enabled.

Thanks for help.

Update: So it is giving me 404 in all cases. I am not using git version, the latest stable gem.

Update 2: Exact issue is:

gh.repos("xxx", "yyy").issues(1).comments.create({:body => "hey i'll help fix that suck"}) 
 {"message"=>"Not Found"}

But the pull request is there, if I go to the issues/1 it gets redirected, issues are enabled. What is possibly wrong?

lzap commented 11 years ago

Any hints for me? Why am I getting 404 while the data is there...

lzap commented 11 years ago

Okay I got it, token was not correctly generated (repos vs repo scope issue).