Reputation: 8260
I'm making some progress with Github API. I followed some of the docs. I have abandoned using curl
from the command line because of issues with quotes. So now I am using a browser and forming urls.
I have successfully created a token, which I know works, because I can now see my own private repositories. The url for this is
https://api.github.com/user/repos?access_token=deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
(I have swapped in fake token because they are to be treated as passwords and not shared)
So far so good, it seems I have access rights to my repositories. So according to this part of the documentation, I ought to be able to query commit comments using something of the form
GET /repos/:owner/:repo/comments
so I have a repo called DMQR and I am user mead so I'm using url
but this returns an empty list
[
]
Do I need the correct scope? I created token as per walkthrough with repo,public_repo,gist, user.
Upvotes: 0
Views: 906
Reputation: 136880
Are you sure that you actually have comments? Note that "commit comments" are not commit messages.
Commit messages are part of your commit. They are generally provided interactively when you commit, and if you ever modify them your commit hash will change. If you have commits, you have commit messages (though it is possible for them to be blank).
Commit messages are a fundamental part of Git, and therefore any Git implementation will support them.
Commit comments are a proprietary GitHub feature:
After you open a pull request in a repository, collaborators or team members can comment on the lines in its diff. Adding line comments is a great way to discuss questions about implementation, or provide feedback to the author.
…
(source: github.com)
This particular example refers to pull requests, but there are other places that you can comment in the GitHub UI.
Assuming you actually want to get commit messages, I think you'll have better luck with the List commits on a repository endpoint:
GET /repos/:owner/:repo/commits
This shows sample output that includes
"commit": { "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e", "author": { "name": "Monalisa Octocat", "email": "[email protected]", "date": "2011-04-14T16:00:49Z" }, "committer": { "name": "Monalisa Octocat", "email": "[email protected]", "date": "2011-04-14T16:00:49Z" }, "message": "Fix all the bugs", "tree": { "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e", "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e" }, "comment_count": 0 },
Take the message
from each commit
in the containing JSON and you should get your list of commit messages.
Upvotes: 2