org.eclipse.egit.github.core.CommitComment / setPath(String path)


I am trying to add an comment on a Pull Request from an Java Application in Eclipse using  GitHub Java API (org.eclipse.egit.github.core)

The scenario should be:

  1. recieving the payload from the webhook at the pull request
  2. connect to the repository
  3. get the pull request
  4. add the comment (using PullRequestService.createComment(…); one of the Parameters is CommitComment -> create Object and set necessary variables.

But then i got this exception: 

org.eclipse.egit.github.core.client.RequestException: Invalid request.

No subschema in “oneOf” matched.
For ‘properties/commit_id’, nil is not a string.
For ‘properties/path’, nil is not a string.

I don’t know what to set for commit_id and path? Can I get those information from the webhook-payload somehow?

Thank you!

Commit comments, which you mention in the title of your post, are separate and different from Pull Request comments, which you mention in the body of your post. There are also Pull Request review comments, which are another type of comment associated with Pull Requests.

If you want to simply add a comment to the pull request conversation page that is not a review comment, you should use the same endpoint as you would for creating a comment on an issue. I don’t know what that translates to in your Java library, but that should point you in the right direction.

Let us know if you have more questions.