Экспортируйте все проблемы и все комментарии в каждом выпуске GitHub. - PullRequest
0 голосов
/ 06 марта 2019

Ожидание -

  1. Экспорт всех проблем с GitHub. Отфильтровано по статусу открытия / закрытия с информацией метки / правопреемника.
  2. Орган выдачи должен содержать все комментарии по данному конкретному вопросу, а не первый комментарий, добавленный при создании проблемы. Это важно. Мы хотим извлечь всю информацию о проблеме в файл .csv.

Я использую следующее

curl -i "https://api.github.com/repos/<repo-owner>/<repo-name>/issues" -u "<user-name>" --output issueExport.txt

Это дает мне экспорт, но только первый комментарий к проблеме в теле. Как мне получить все комментарии к проблеме?

Вот как выглядит вывод

 HTTP/1.1 200 OK
Server: GitHub.com
Date: Wed, 06 Mar 2019 05:18:01 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 9408
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4992
X-RateLimit-Reset: 1551853081
Cache-Control: private, max-age=60, s-maxage=60
Vary: Accept, Authorization, Cookie, X-GitHub-OTP
ETag: "3dec541c82ed153bea0f2eaf14482fba"
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-GitHub-Request-Id: 0436:053B:3F7D1D:7C4FAE:5C7F5808

[
  {
    "url": "https://api.github.com/repos/username/RepoName/issues/3",
    "repository_url": "https://api.github.com/repos/username/RepoName",
    "labels_url": "https://api.github.com/repos/username/RepoName/issues/3/labels{/name}",
    "comments_url": "https://api.github.com/repos/username/RepoName/issues/3/comments",
    "events_url": "https://api.github.com/repos/username/RepoName/issues/3/events",
    "html_url": "https://github.com/username/RepoName/issues/3",
    "id": 417232567,
    "node_id": "MDU6SXNzdWU0MTcyMzI1Njc=",
    "number": 3,
    "title": "CEAS-345",
    "user": {
      "login": "usernameG",
      "id": 47857828,
      "node_id": "MDQ6VXNlcjQ3ODU3ODI4",
      "avatar_url": "https://avatars3.githubusercontent.com/u/47857828?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/usernameG",
      "html_url": "https://github.com/usernameG",
      "followers_url": "https://api.github.com/users/usernameG/followers",
      "following_url": "https://api.github.com/users/usernameG/following{/other_user}",
      "gists_url": "https://api.github.com/users/usernameG/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/usernameG/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/usernameG/subscriptions",
      "organizations_url": "https://api.github.com/users/usernameG/orgs",
      "repos_url": "https://api.github.com/users/usernameG/repos",
      "events_url": "https://api.github.com/users/usernameG/events{/privacy}",
      "received_events_url": "https://api.github.com/users/usernameG/received_events",
      "type": "User",
      "site_admin": false
    },
    "labels": [
      {
        "id": 1257724247,
        "node_id": "MDU6TGFiZWwxMjU3NzI0MjQ3",
        "url": "https://api.github.com/repos/username/RepoName/labels/duplicate",
        "name": "duplicate",
        "color": "cfd3d7",
        "default": true
      }
    ],
    "state": "open",
    "locked": false,
    "assignee": null,
    "assignees": [

    ],
    "milestone": null,
    "comments": 1,
    "created_at": "2019-03-05T10:43:50Z",
    "updated_at": "2019-03-05T20:41:29Z",
    "closed_at": null,
    "author_association": "COLLABORATOR",
    "body": "Remove\r\nhttps://github.com/username/RepoName/blob/9b0b6587cef4fabde769ab4633ec8b916b95aa0c/src/destructiveChangesPost.xml#L5-L8"
  },
  {
    "url": "https://api.github.com/repos/username/RepoName/issues/2",
    "repository_url": "https://api.github.com/repos/username/RepoName",
    "labels_url": "https://api.github.com/repos/username/RepoName/issues/2/labels{/name}",
    "comments_url": "https://api.github.com/repos/username/RepoName/issues/2/comments",
    "events_url": "https://api.github.com/repos/username/RepoName/issues/2/events",
    "html_url": "https://github.com/username/RepoName/issues/2",
    "id": 417197715,
    "node_id": "MDU6SXNzdWU0MTcxOTc3MTU=",
    "number": 2,
    "title": "CEAS-123",
    "user": {
      "login": "username",
      "id": 42571385,
      "node_id": "MDQ6VXNlcjQyNTcxMzg1",
      "avatar_url": "https://avatars1.githubusercontent.com/u/42571385?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/username",
      "html_url": "https://github.com/username",
      "followers_url": "https://api.github.com/users/username/followers",
      "following_url": "https://api.github.com/users/username/following{/other_user}",
      "gists_url": "https://api.github.com/users/username/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/username/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/username/subscriptions",
      "organizations_url": "https://api.github.com/users/username/orgs",
      "repos_url": "https://api.github.com/users/username/repos",
      "events_url": "https://api.github.com/users/username/events{/privacy}",
      "received_events_url": "https://api.github.com/users/username/received_events",
      "type": "User",
      "site_admin": false
    },
    "labels": [
      {
        "id": 1257724245,
        "node_id": "MDU6TGFiZWwxMjU3NzI0MjQ1",
        "url": "https://api.github.com/repos/username/RepoName/labels/bug",
        "name": "bug",
        "color": "d73a4a",
        "default": true
      }
    ],
    "state": "open",
    "locked": false,
    "assignee": {
      "login": "username",
      "id": 42571385,
      "node_id": "MDQ6VXNlcjQyNTcxMzg1",
      "avatar_url": "https://avatars1.githubusercontent.com/u/42571385?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/username",
      "html_url": "https://github.com/username",
      "followers_url": "https://api.github.com/users/username/followers",
      "following_url": "https://api.github.com/users/username/following{/other_user}",
      "gists_url": "https://api.github.com/users/username/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/username/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/username/subscriptions",
      "organizations_url": "https://api.github.com/users/username/orgs",
      "repos_url": "https://api.github.com/users/username/repos",
      "events_url": "https://api.github.com/users/username/events{/privacy}",
      "received_events_url": "https://api.github.com/users/username/received_events",
      "type": "User",
      "site_admin": false
    },
    "assignees": [
      {
        "login": "username",
        "id": 42571385,
        "node_id": "MDQ6VXNlcjQyNTcxMzg1",
        "avatar_url": "https://avatars1.githubusercontent.com/u/42571385?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/username",
        "html_url": "https://github.com/username",
        "followers_url": "https://api.github.com/users/username/followers",
        "following_url": "https://api.github.com/users/username/following{/other_user}",
        "gists_url": "https://api.github.com/users/username/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/username/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/username/subscriptions",
        "organizations_url": "https://api.github.com/users/username/orgs",
        "repos_url": "https://api.github.com/users/username/repos",
        "events_url": "https://api.github.com/users/username/events{/privacy}",
        "received_events_url": "https://api.github.com/users/username/received_events",
        "type": "User",
        "site_admin": false
      }
    ],
    "milestone": null,
    "comments": 1,
    "created_at": "2019-03-05T09:26:08Z",
    "updated_at": "2019-03-05T09:28:39Z",
    "closed_at": null,
    "author_association": "OWNER",
    "body": "Fix this - don't use constant\r\nhttps://github.com/username/RepoName/blob/c05a78485565f38c83b604d2125d24355ded1a60/src/destructiveChangesPost.xml#L2-L4"
  },
  {
    "url": "https://api.github.com/repos/username/RepoName/issues/1",
    "repository_url": "https://api.github.com/repos/username/RepoName",
    "labels_url": "https://api.github.com/repos/username/RepoName/issues/1/labels{/name}",
    "comments_url": "https://api.github.com/repos/username/RepoName/issues/1/comments",
    "events_url": "https://api.github.com/repos/username/RepoName/issues/1/events",
    "html_url": "https://github.com/username/RepoName/pull/1",
    "id": 417197484,
    "node_id": "MDExOlB1bGxSZXF1ZXN0MjU4MjQ1NDcw",
    "number": 1,
    "title": "Update destructiveChangesPost.xml",
    "user": {
      "login": "username",
      "id": 42571385,
      "node_id": "MDQ6VXNlcjQyNTcxMzg1",
      "avatar_url": "https://avatars1.githubusercontent.com/u/42571385?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/username",
      "html_url": "https://github.com/username",
      "followers_url": "https://api.github.com/users/username/followers",
      "following_url": "https://api.github.com/users/username/following{/other_user}",
      "gists_url": "https://api.github.com/users/username/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/username/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/username/subscriptions",
      "organizations_url": "https://api.github.com/users/username/orgs",
      "repos_url": "https://api.github.com/users/username/repos",
      "events_url": "https://api.github.com/users/username/events{/privacy}",
      "received_events_url": "https://api.github.com/users/username/received_events",
      "type": "User",
      "site_admin": false
    },
    "labels": [

    ],
    "state": "open",
    "locked": false,
    "assignee": null,
    "assignees": [

    ],
    "milestone": null,
    "comments": 0,
    "created_at": "2019-03-05T09:25:34Z",
    "updated_at": "2019-03-05T10:44:23Z",
    "closed_at": null,
    "author_association": "OWNER",
    "pull_request": {
      "url": "https://api.github.com/repos/username/RepoName/pulls/1",
      "html_url": "https://github.com/username/RepoName/pull/1",
      "diff_url": "https://github.com/username/RepoName/pull/1.diff",
      "patch_url": "https://github.com/username/RepoName/pull/1.patch"
    },
    "body": ""
  }
]

1 Ответ

0 голосов
/ 06 марта 2019

Вы должны GET комментарии отдельно, используя Список комментариев к проблеме конечная точка, например:

GET /repos/:owner/:repo/issues/:number/comments

Надеюсь, это поможет.

...