Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

How to post non file-specific/commit specific comments to PRs

According to https://developer.github.com/v3/pulls/comments/#create-a-comment all parameters 

  1. commit_id
  2. path
  3. position

are required. But what do I have to pass if I want to add a generic PR comment (not related to a specific commit or path)? Can I just leave those parameters empty?

It would be nice if the documentation could be clarified in this regard.

 

Thanks,

Konrad

1 Reply
Community Manager
Message 2 of 2

Re: How to post non file-specific/commit specific comments to PRs

Hi @kwin,

 

I'm afraid leaving those params empty wouldn't work. As far as I know you have to associate the comment when in a review stage. However, you can create a new comment.

 

Using GraphQL for example:

 

`FindPullRequestID` first

then `AddPullRequestComment`

 

query FindPullRequestID {
  repository(owner:"andreagriffiths11", name:"graphql-test") {
    pullRequest(number:1) {
      id
    }
  }
}

mutation AddPullRequestComment {
  addComment(input:{subjectId:"MDExOlB1bGxSZXF1ZXN0MjcwMjQwOTUw",body: "test generic comment"}) {
    commentEdge {
    	node {
        createdAt
        body
      }
    }
    subject {
      id
    }
  }
}

 I hope this helps!

 

 


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!