【问题标题】:Github : How to list milestone updates for an issueGithub:如何列出问题的里程碑更新
【发布时间】:2019-03-11 17:53:06
【问题描述】:

如何为特定工单列出当前里程碑及其先前分配的里程碑(如果适用)(+ 每个里程碑更新的日期)?我签入了 github API (https://developer.github.com/v3/issues/#get-a-single-issue),我可以提取当前里程碑,但不能提取之前分配的里程碑(如果它们存在)。有什么想法吗?

谢谢,

【问题讨论】:

    标签: github github-api


    【解决方案1】:

    您可以使用Issues Events API。为了测试这一点,我去了一个测试问题:

    1. 添加里程碑new
    2. 添加里程碑two

    在使用该端点查询 API 后,我得到了三个事件,两个是 milestoned,一个是 demilestoned。该端点允许您专门过滤这些事件,以消除非常活跃的问题上的噪音。这是回复的示例(带有混淆数据)

    [
      {
        "id": 2193329921,  
        "url": "https://api.github.com/repos/myOrg/myRepo/issues/events/2193329921",
        "actor": {
          "login": "myuser",
          "id": 1192590,
          "node_id": "MDQ6VXNlcjExOTI1OTA=",    
          "gravatar_id": "",
          "url": "https://api.github.com/users/myuser",
          "html_url": "https://github.com/myuser",
          "followers_url": "https://api.github.com/users/myuser/followers",
          "following_url": "https://api.github.com/users/myuser/following{/other_user}",
          "gists_url": "https://api.github.com/users/myuser/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/myuser/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/myuser/subscriptions",
          "organizations_url": "https://api.github.com/users/myuser/orgs",
          "repos_url": "https://api.github.com/users/myuser/repos",
          "events_url": "https://api.github.com/users/myuser/events{/privacy}",
          "received_events_url": "https://api.github.com/users/myuser/received_events",
          "type": "User",
          "site_admin": true
        },
        "event": "milestoned",
        "commit_id": null,
        "commit_url": null,
        "created_at": "2019-03-11T09:42:00Z",
        "milestone": {
          "title": "new"
        }
      },
      {
        "id": 2193330104,    
        "url": "https://api.github.com/repos/myOrg/myRepo/issues/events/2193330104",
        "actor": {
          "login": "myuser",
          "id": 1192590,  
          "url": "https://api.github.com/users/myuser",
          "html_url": "https://github.com/myuser",
          "followers_url": "https://api.github.com/users/myuser/followers",
          "following_url": "https://api.github.com/users/myuser/following{/other_user}",
          "gists_url": "https://api.github.com/users/myuser/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/myuser/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/myuser/subscriptions",
          "organizations_url": "https://api.github.com/users/myuser/orgs",
          "repos_url": "https://api.github.com/users/myuser/repos",
          "events_url": "https://api.github.com/users/myuser/events{/privacy}",
          "received_events_url": "https://api.github.com/users/myuser/received_events",
          "type": "User",
          "site_admin": true
        },
        "event": "demilestoned",
        "commit_id": null,
        "commit_url": null,
        "created_at": "2019-03-11T09:42:04Z",
        "milestone": {
          "title": "new"
        }
      },
      {
        "id": 2193330105,
        "url": "https://api.github.com/repos/myOrg/myRepo/issues/events/2193330105",
        "actor": {
          "login": "myuser",
          "url": "https://api.github.com/users/myuser",
          "html_url": "https://github.com/myuser",
          "followers_url": "https://api.github.com/users/myuser/followers",
          "following_url": "https://api.github.com/users/myuser/following{/other_user}",
          "gists_url": "https://api.github.com/users/myuser/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/myuser/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/myuser/subscriptions",
          "organizations_url": "https://api.github.com/users/myuser/orgs",
          "repos_url": "https://api.github.com/users/myuser/repos",
          "events_url": "https://api.github.com/users/myuser/events{/privacy}",
          "received_events_url": "https://api.github.com/users/myuser/received_events",
          "type": "User",
          "site_admin": true
        },
        "event": "milestoned",
        "commit_id": null,
        "commit_url": null,
        "created_at": "2019-03-11T09:42:04Z",
        "milestone": {
          "title": "second"
        }
      }
    ]
    
    

    【讨论】:

      猜你喜欢
      • 2022-01-19
      • 2018-03-11
      • 2013-03-12
      • 2021-03-09
      • 2012-03-28
      • 2018-12-31
      • 2020-05-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多