get-github-pr-review-comments icon indicating copy to clipboard operation
get-github-pr-review-comments copied to clipboard

How to know that comment is resolved?

Open azu opened this issue 8 years ago • 1 comments

GitHub collapse comment which is resolved. How to get the information?

azu avatar Mar 05 '17 05:03 azu

I wanted to answer the same question myself, so I started playing with https://hub.github.com/ and the GraphQL explorer and found out. I've also scratched a few other itches, like the issue in https://github.com/azu/get-github-pr-review-comments/pull/7#issuecomment-548427355 by doing something 'good enough' for my use case with bash. https://github.com/markburns/flow/blob/d023045682fefaf25717a9c97f0b58dd9625950d/bin/comments#L4

I'll probably carry on solving my issues by adding to my own collection of scripts in that repo, rather than changing your tool, but I hope I can at least be useful by sharing this GraphQL query

I minimised this comment: https://github.com/azu/get-github-pr-review-comments/pull/7#issuecomment-548271507 to test it

 hub api --paginate graphql -f query=' query ($end: String) {
  repository(name:"get-github-pr-review-comments", owner:"azu"){
   name
   pullRequests(first: 10, after: $end){
    nodes{
      url
      comments(first: 5){
        nodes{
          author{
            login

          }
          isMinimized
          bodyText
        }
        totalCount
      }
    }
    pageInfo {
      endCursor
      startCursor
    }
  }
  }
}' | jq
{
  "data": {
    "repository": {
      "name": "get-github-pr-review-comments",
      "pullRequests": {
        "nodes": [
          {
            "url": "https://github.com/azu/get-github-pr-review-comments/pull/2",
            "comments": {
              "nodes": [
                {
                  "author": {
                    "login": "azu"
                  },
                  "isMinimized": false,
                  "bodyText": "masterとコンフリクトしてるので( #3 )のでそれが解決できたらマージOKそうです。"
                },
                {
                  "author": {
                    "login": "dito"
                  },
                  "isMinimized": false,
                  "bodyText": "修正完了しました。"
                },
                {
                  "author": {
                    "login": "azu"
                  },
                  "isMinimized": false,
                  "bodyText": "ありがとうございます。\nhttps://github.com/azu/get-github-pr-review-comments/releases/tag/1.1.0 1.1.0をリリースしました。"
                }
              ],
              "totalCount": 3
            }
          },
          {
            "url": "https://github.com/azu/get-github-pr-review-comments/pull/3",
            "comments": {
              "nodes": [
                {
                  "author": {
                    "login": "azu"
                  },
                  "isMinimized": false,
                  "bodyText": "ありがとうございます"
                }
              ],
              "totalCount": 1
            }
          },
          {
            "url": "https://github.com/azu/get-github-pr-review-comments/pull/4",
            "comments": {
              "nodes": [
                {
                  "author": {
                    "login": "azu"
                  },
                  "isMinimized": false,
                  "bodyText": "@josjos7 ありがとうございます。\n1.2.0をリリースしました"
                }
              ],
              "totalCount": 1
            }
          },
          {
            "url": "https://github.com/azu/get-github-pr-review-comments/pull/5",
            "comments": {
              "nodes": [],
              "totalCount": 0
            }
          },
          {
            "url": "https://github.com/azu/get-github-pr-review-comments/pull/7",
            "comments": {
              "nodes": [
                {
                  "author": {
                    "login": "markburns"
                  },
                  "isMinimized": true,
                  "bodyText": "Hey @azu thanks for the fix for issue #6. Actually this introduces slightly different behaviour to what I'd expect.\nNow if there's a local commit that is not on the remote, the entirety of the output is just \"No comments\" which isn't exactly true, because if you then push, then you get a list of all the previous comments again.\nWhat I'd expect in both scenarios is for it to list the same list of comments."
                },
                {
                  "author": {
                    "login": "azu"
                  },
                  "isMinimized": false,
                  "bodyText": "Using SHA is tricky reason.\nI want to get pull request url from current branch name or SHA, but I do not know such API.\nIf GitHub provide suitable API, We can improve this search logic.\n\n  \n    \n      get-github-pr-review-comments/src/GitHub.js\n    \n    \n        Lines 25 to 30\n      in\n      decc8c8\n    \n    \n    \n    \n\n        \n          \n           getPR({ owner, repo, commitSha }) { \n        \n\n        \n          \n               const repoPath = this._createRepoString({ owner, repo }); \n        \n\n        \n          \n               return this.github.search.issues({ \n        \n\n        \n          \n                   q: `repo:${repoPath} type:pr ${commitSha}` \n        \n\n        \n          \n               }); \n        \n\n        \n          \n           } \n        \n    \n  \n\n\nMaybe, use oldtest commit SHA(that is pushed) instead of git rev-parse HEAD resolve this issue."
                },
                {
                  "author": {
                    "login": "markburns"
                  },
                  "isMinimized": false,
                  "bodyText": "Ah I see. So I presume you could iteratively go back through SHAs until you get a result? Sorry I haven’t looked at your code in detail."
                }
              ],
              "totalCount": 3
            }
          }
        ],
        "pageInfo": {
          "endCursor": "Y3Vyc29yOnYyOpHOE_GYyw==",
          "startCursor": "Y3Vyc29yOnYyOpHOB0HDbQ=="
        }
      }
    }
  }
}

markburns avatar Jan 05 '20 07:01 markburns