Giter Club home page Giter Club logo

Comments (1)

proivk avatar proivk commented on August 30, 2024

Adding some debug info.
Adding comment for the same code, same PR, same line (18th line) but after GHStartReview and w.o GHStartReview

  1. Debug info for the case after GHStartReview
[info] [gh] cmd: "gh api graphql -F pull=\"PR_kwDOIkxU8c5LxKOy\" -F review=\"PRR_kwDOIkxU8c5PmQ9h\" -F body='Comment on 18th line after StartReview' -F path=\"pkg/checks/test.go\" -F pos=18 -F sha=\"2168d255022aba12890a9a96bd8a0a0e21554f9f\" -f query='mutation ($pull: ID!, $review: ID!, $body: String!, $path: String!, $pos: Int!, $sha: GitObjectID!) {\n  addPullRequestReviewComment(\n    input: {pullRequestId: $pull, pullRequestReviewId: $review, body: $body, path: $path, position: $pos, commitOID: $sha}\n  ) {\n    clientMutationId\n  }\n}\n'" out:
'{"data":{"addPullRequestReviewComment":{"clientMutationId":null}}}'

As the result comment appears on line 26 but should be on line 18th

 out:
{
  data = {
    repository = {
      pullRequest = {
        reviewThreads = {
          edges = { {
              node = {
                comments = {
                  edges = { {
                      node = {
                        author = {
...
                        },
                        body = "Comment on 18th line after StartReview",
                        commit = {
                          oid = "05c0258f3bf3e50b5a3bf19d240197bf6b216fdd",
                          parents = {
                            edges = { {
                                node = {
                                  id = "C_kwDOIkxU8doAKDdhNzExMjlmOTljY2VmZjYwODZmYzFkNmYwNzMwZjY4NDQ5YjJjNjM",
                                  oid = "7a71129f99cceff6086fc1d6f0730f68449b2c63"
                                }
                              } }
                          }
                        },
                        createdAt = "2023-03-10T18:46:40Z",
                        diffHunk = "...",
                        id = "PRRC_kwDOIkxU8c5DhHXQ",
                        originalCommit = {
                          oid = "2168d255022aba12890a9a96bd8a0a0e21554f9f",
                          parents = {
                            edges = { {
                                node = {
                                  id = "C_kwDOIkxU8doAKDE3ZjRlNDBhMzI0MTNhZDgzNzE1ZDU0ZWQ4MjUyZDI3NzdhNjA1NTg",
                                  oid = "17f4e40a32413ad83715d54ed8252d2777a60558"
                                }
                              } }
                          }
                        },
                        originalPosition = 18,
                        path = "pkg/checks/test.go",
                        position = 24,
                        publishedAt = vim.NIL,
                        pullRequestReview = {
                          id = "PRR_kwDOIkxU8c5PmQ9h"
                        },
                        reactions = {
                          edges = {}
                        },
                        replyTo = vim.NIL,
                        state = "PENDING",
                        updatedAt = "2023-03-10T18:46:40Z",
                        url = "...",
                        viewerCanDelete = true,
                        viewerCanMinimize = false,
                        viewerCanReact = true,
                        viewerCanUpdate = true,
                        viewerCannotUpdateReasons = {},
                        viewerDidAuthor = true
                      }
                    } }
                },
                diffSide = "RIGHT",
                id = "PRRT_kwDOIkxU8c4rLLvq",
                isOutdated = false,
                isResolved = false,
                line = 26,
                originalLine = 26,
                originalStartLine = vim.NIL,
                path = "pkg/checks/test.go",
                resolvedBy = vim.NIL,
                startDiffSide = vim.NIL,
                startLine = 26,
                viewerCanReply = true,
                viewerCanResolve = false,
                viewerCanUnresolve = false
              }
            } },
          pageInfo = {
            endCursor = "...",
            hasNextPage = false
          }
        }
      }
    }
  }
}

  1. Debug info w/o GHStartReview
[info] [gh] cmd: "gh api --method POST -H \"Accept: application/vnd.github.v3+json\" /repos/{owner}/{repo}/pulls/21/comments -f commit_id=2168d255022aba12890a9a96bd8a0a0e21554f9f -f path=pkg/checks/test.go -f side=RIGHT -F position=10 -F line=18 -f body='Comment on 18th line w/o starting review'" out:
'{"url":"...","pull_request_review_id":1335466576,"id":1132775409,"node_id":"PRRC_kwDOIkxU8c5DhMfx","diff_hunk":"...","path":"pkg/checks/test.go","position":13,"original_position":12,"commit_id":"05c0258f3bf3e50b5a3bf19d240197bf6b216fdd","original_commit_id":"2168d255022aba12890a9a96bd8a0a0e21554f9f","user":{...},"body":"Comment on 18th line w/o starting review","created_at":"2023-03-10T19:06:10Z","updated_at":"2023-03-10T19:06:10Z","html_url":"...","pull_request_url":"...","author_association":"CONTRIBUTOR","_links":{...},"reactions":{"url":"...","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"start_line":null,"original_start_line":null,"start_side":null,"line":18,"original_line":18,"side":"RIGHT"}'

As the result comment appears on the right line - 18th line.

[info] [gh] cmd: gh api graphql -F owner={owner} -F name={repo} -F pull_number=21 -f query=query ($name: String!, $owner: String!, $pull_number: Int!) {
  repository(name: $name, owner: $owner) {
    pullRequest(number: $pull_number) {
      reviewThreads(first: 50) {
        pageInfo {
          endCursor
          hasNextPage
        }
        edges {
          node {
            id
            diffSide
            isOutdated
            isResolved
            line
            originalLine
            originalStartLine
            path
            startDiffSide
            startLine
            viewerCanReply
            viewerCanResolve
            viewerCanUnresolve
            resolvedBy {
              login
            }
            comments(first: 100) {
              edges {
                node {
                  id
                  author {
                    login
                    avatarUrl
                    resourcePath
                    url
                  }
                  body
                  createdAt
                  path
                  position
                  originalPosition
                  publishedAt
                  replyTo {
                    id
                  }
                  pullRequestReview {
                    id
                  }
                  commit {
                    oid
                    parents(first: 1) {
                      edges {
                        node {
                          id
                          oid
                        }
                      }
                    }
                  }
                  originalCommit {
                    oid
                    parents(first: 1) {
                      edges {
                        node {
                          id
                          oid
                        }
                      }
                    }
                  }
                  reactions(first:20) {
                    edges {
                      node {
                        content
                        id
                        user {
                          login
                        }
                      }
                    }
                  }
                  state
                  updatedAt
                  viewerCanDelete
                  viewerCanMinimize
                  viewerCanReact
                  viewerCanUpdate
                  viewerCannotUpdateReasons
                  viewerDidAuthor
                  url
                  diffHunk
                }
              }
            }
          }
        }
      }
    }
  }
}
 out:
{
  data = {
    repository = {
      pullRequest = {
        reviewThreads = {
          edges = { {
              node = {
                comments = {
                  edges = { {
                      node = {
                        author = {
                         ...
                        },
                        body = "Comment on 18th line w/o starting review",
                        commit = {
                          oid = "05c0258f3bf3e50b5a3bf19d240197bf6b216fdd",
                          parents = {
                            edges = { {
                                node = {
                                  id = "C_kwDOIkxU8doAKDdhNzExMjlmOTljY2VmZjYwODZmYzFkNmYwNzMwZjY4NDQ5YjJjNjM",
                                  oid = "7a71129f99cceff6086fc1d6f0730f68449b2c63"
                                }
                              } }
                          }
                        },
                        createdAt = "2023-03-10T19:06:10Z",
                        diffHunk = '...',
                        id = "PRRC_kwDOIkxU8c5DhMfx",
                        originalCommit = {
                          oid = "2168d255022aba12890a9a96bd8a0a0e21554f9f",
                          parents = {
                            edges = { {
                                node = {
                                  id = "C_kwDOIkxU8doAKDE3ZjRlNDBhMzI0MTNhZDgzNzE1ZDU0ZWQ4MjUyZDI3NzdhNjA1NTg",
                                  oid = "17f4e40a32413ad83715d54ed8252d2777a60558"
                                }
                              } }
                          }
                        },
                        originalPosition = 12,
                        path = "pkg/checks/test.go",
                        position = 13,
                        publishedAt = "2023-03-10T19:06:11Z",
                        pullRequestReview = {
                          id = "PRR_kwDOIkxU8c5PmZpQ"
                        },
                        reactions = {
                          edges = {}
                        },
                        replyTo = vim.NIL,
                        state = "SUBMITTED",
                        updatedAt = "2023-03-10T19:06:11Z",
                        url = "...",
                        viewerCanDelete = true,
                        viewerCanMinimize = true,
                        viewerCanReact = true,
                        viewerCanUpdate = true,
                        viewerCannotUpdateReasons = {},
                        viewerDidAuthor = true
                      }
                    } }
                },
                diffSide = "RIGHT",
                id = "PRRT_kwDOIkxU8c4rLPFg",
                isOutdated = false,
                isResolved = false,
                line = 18,
                originalLine = 18,
                originalStartLine = vim.NIL,
                path = "pkg/checks/test.go",
                resolvedBy = vim.NIL,
                startDiffSide = vim.NIL,
                startLine = 18,
                viewerCanReply = true,
                viewerCanResolve = true,
                viewerCanUnresolve = false
              }
            } },
          pageInfo = {
            endCursor = "Y3Vyc29yOnYyOpK0MjAyMy0wMy0xMFQxOTowNjoxMFrOKyzxYA==",
            hasNextPage = false
          }
        }
      }
    }
  }
}

Feel free to contact me if you need some live demo or troubleshooting session.

from gh.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.