Create comment on pull request

前端 未结 3 1611
刺人心
刺人心 2020-12-25 10:30

GitHub\'s comment API seems to allow you to create comments on a pull request, but only if you supply a specific line number in the diff to comment on. Is there a way to cr

3条回答
  •  青春惊慌失措
    2020-12-25 11:16

    Using GraphQL API v4, you would need to get the Pull Request id using pullrequest Schema and perform addComment mutation afterwards :

    query FindPullRequestID {
      repository(owner:"bertrandmartel", name:"ustream-dl") {
        pullRequest(number:2) {
          id
        }
      }
    }
    
    mutation AddPullRequestComment {
      addComment(input:{subjectId:"MDExOlB1bGxSZXF1ZXN0MTU0NzExOTA0",body: "test comment"}) {
        commentEdge {
            node {
            createdAt
            body
          }
        }
        subject {
          id
        }
      }
    }
    

    Try it in the explorer

提交回复
热议问题