Перечислите все неразрешенные комментарии запроса на извлечение - PullRequest
0 голосов
/ 16 апреля 2019

Мы используем клиент @ octokit / rest , чтобы получить все комментарии по запросу извлечения:

client.pulls.listComments({
    owner,
    repo,
    pull_number: 34,
    per_page: 100
}).then(result => {
    console.log(result.data.length);
    console.log(result.data[0]);
});

Как, если вообще мы можем перечислить только неразрешенные комментарии? Похоже, в данных отсутствует свойство, указывающее, разрешил ли кто-то комментарий или нет.

1 Ответ

2 голосов
/ 16 апреля 2019

Вкл. GitHub.com , не все комментарии по запросу извлечения имеют статус resolved/unresolved, а только комментарии как часть обзора. И API GitHubs v3 , который используется octokit , не предоставляет такого статуса, как часть ответа GET на комментарии к обзору, и пример ответа того же это:

[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
    "id": 10,
    "node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw",
    "pull_request_review_id": 42,
    "diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
    "path": "file1.txt",
    "position": 1,
    "original_position": 4,
    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    "original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
    "in_reply_to_id": 8,
    "user": {
      "login": "octocat",
      "id": 1,
      "node_id": "MDQ6VXNlcjE=",
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "",
      "url": "https://api.github.com/users/octocat",
      "html_url": "https://github.com/octocat",
      "followers_url": "https://api.github.com/users/octocat/followers",
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "repos_url": "https://api.github.com/users/octocat/repos",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "Great stuff",
    "created_at": "2011-04-14T16:00:49Z",
    "updated_at": "2011-04-14T16:00:49Z",
    "html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
    "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    "_links": {
      "self": {
        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
      },
      "html": {
        "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
      },
      "pull_request": {
        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
      }
    }
  }
]

По сути, я не думаю, что ваше требование в настоящее время может быть удовлетворено с помощью API GitHub v3 или Octokit. Подробнее об этом вы можете узнать из документации API GitHub v3

...