简体   繁体   English

导出每个GitHub问题中的所有问题和所有评论

[英]Export all issues and all comments in every GitHub issue

Expectation - 期望-

  1. Export all GitHub issues. 导出所有GitHub问题。 Filtered by open/close status with Label/assignee information. 按打开/关闭状态和标签/受让人信息过滤。
  2. The issuing body should contain all the comments in that particular issue and not the first comment added during creation of issue. 发行机构应包含该特定问题中的所有评论,而不是在问题创建期间添加的第一条评论。 This is important. 这个很重要。 We want to extract all the issue information to .csv file. 我们希望将所有问题信息提取到.csv文件中。

I am using the following 我正在使用以下

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

This gives me the export but only the first comment from the issue in the body. 这给了我出口的机会,但只是该问题的第一条评论。 How do I get all the comments from the issue? 我如何从问题中获得所有评论?

This is what the output looks like 这就是输出的样子

 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": ""
  }
]

You have to GET comments separately using List comments on an issue endpoint, for example: 您必须使用问题端点上的列表注释单独GET注释,例如:

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

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM