Skip to main content

此版本的 GitHub Enterprise Server 已于以下日期停止服务 2024-03-26. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

站点管理员将企业服务器实例升级为 Enterprise Server 3.9 或更高版本后,REST API 将进行版本控制。 若要了解如何查找实例的版本,请参阅“关于 GitHub Docs 的版本”。 有关详细信息,请参阅“关于 API 版本控制”。

适用于时间线事件的 REST API 终结点

使用 REST API 接收由问题和拉取请求中的时间线活动触发的事件。

关于时间线事件

可以使用 REST API 查看问题和拉取请求中的时间线活动触发的不同类型的事件。 有关可接收的特定事件的详细信息,请参阅“议题事件类型”。 若要查看问题和拉取请求之外的 GitHub 活动,请参阅“GitHub 事件类型”。

可以使用时间线事件显示有关问题和拉取请求的信息,或确定应向谁通知问题评论。

每个拉取请求都是一个议题,但并非每个议题都是拉取请求。 因此,“问题”终结点中为这两项功能提供了“共享”操作,如操作代理人、标签和里程碑。

List timeline events for an issue

List all timeline events for an issue.

“List timeline events for an issue”的参数

标头
名称, 类型, 说明
accept string

Setting to application/vnd.github+json is recommended.

路径参数
名称, 类型, 说明
owner string 必须

The account owner of the repository. The name is not case sensitive.

repo string 必须

The name of the repository without the .git extension. The name is not case sensitive.

issue_number integer 必须

The number that identifies the issue.

查询参数
名称, 类型, 说明
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

默认: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

默认: 1

“List timeline events for an issue”的 HTTP 响应状态代码

状态代码说明
200

OK

404

Resource not found

410

Gone

“List timeline events for an issue”的示例代码

请求示例

get/repos/{owner}/{repo}/issues/{issue_number}/timeline
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/issues/ISSUE_NUMBER/timeline

Response

Status: 200
[ { "id": 6430295168, "node_id": "LOE_lADODwFebM5HwC0kzwAAAAF_RoSA", "url": "https://HOSTNAME/repos/github/roadmap/issues/events/6430295168", "actor": { "login": "github", "id": 9919, "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4", "gravatar_id": "", "url": "https://HOSTNAME/users/github", "html_url": "https://github.com/github", "followers_url": "https://HOSTNAME/users/github/followers", "following_url": "https://HOSTNAME/users/github/following{/other_user}", "gists_url": "https://HOSTNAME/users/github/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/github/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/github/subscriptions", "organizations_url": "https://HOSTNAME/users/github/orgs", "repos_url": "https://HOSTNAME/users/github/repos", "events_url": "https://HOSTNAME/users/github/events{/privacy}", "received_events_url": "https://HOSTNAME/users/github/received_events", "type": "Organization", "site_admin": false }, "event": "locked", "commit_id": null, "commit_url": null, "created_at": "2022-04-13T20:49:13Z", "lock_reason": null, "performed_via_github_app": null }, { "id": 6430296748, "node_id": "LE_lADODwFebM5HwC0kzwAAAAF_Roqs", "url": "https://HOSTNAME/repos/github/roadmap/issues/events/6430296748", "actor": { "login": "github-product-roadmap", "id": 67656570, "node_id": "MDQ6VXNlcjY3NjU2NTcw", "avatar_url": "https://avatars.githubusercontent.com/u/67656570?v=4", "gravatar_id": "", "url": "https://HOSTNAME/users/github-product-roadmap", "html_url": "https://github.com/github-product-roadmap", "followers_url": "https://HOSTNAME/users/github-product-roadmap/followers", "following_url": "https://HOSTNAME/users/github-product-roadmap/following{/other_user}", "gists_url": "https://HOSTNAME/users/github-product-roadmap/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/github-product-roadmap/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/github-product-roadmap/subscriptions", "organizations_url": "https://HOSTNAME/users/github-product-roadmap/orgs", "repos_url": "https://HOSTNAME/users/github-product-roadmap/repos", "events_url": "https://HOSTNAME/users/github-product-roadmap/events{/privacy}", "received_events_url": "https://HOSTNAME/users/github-product-roadmap/received_events", "type": "User", "site_admin": false }, "event": "labeled", "commit_id": null, "commit_url": null, "created_at": "2022-04-13T20:49:34Z", "label": { "name": "beta", "color": "99dd88" }, "performed_via_github_app": null }, { "id": 6635165802, "node_id": "RTE_lADODwFebM5HwC0kzwAAAAGLfJhq", "url": "https://HOSTNAME/repos/github/roadmap/issues/events/6635165802", "actor": { "login": "github-product-roadmap", "id": 67656570, "node_id": "MDQ6VXNlcjY3NjU2NTcw", "avatar_url": "https://avatars.githubusercontent.com/u/67656570?v=4", "gravatar_id": "", "url": "https://HOSTNAME/users/github-product-roadmap", "html_url": "https://github.com/github-product-roadmap", "followers_url": "https://HOSTNAME/users/github-product-roadmap/followers", "following_url": "https://HOSTNAME/users/github-product-roadmap/following{/other_user}", "gists_url": "https://HOSTNAME/users/github-product-roadmap/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/github-product-roadmap/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/github-product-roadmap/subscriptions", "organizations_url": "https://HOSTNAME/users/github-product-roadmap/orgs", "repos_url": "https://HOSTNAME/users/github-product-roadmap/repos", "events_url": "https://HOSTNAME/users/github-product-roadmap/events{/privacy}", "received_events_url": "https://HOSTNAME/users/github-product-roadmap/received_events", "type": "User", "site_admin": false }, "event": "renamed", "commit_id": null, "commit_url": null, "created_at": "2022-05-18T19:29:01Z", "rename": { "from": "Secret scanning: dry-runs for enterprise-level custom patterns (cloud)", "to": "Secret scanning: dry-runs for enterprise-level custom patterns" }, "performed_via_github_app": null }, { "url": "https://HOSTNAME/repos/github/roadmap/issues/comments/1130876857", "html_url": "https://github.com/github/roadmap/issues/493#issuecomment-1130876857", "issue_url": "https://HOSTNAME/repos/github/roadmap/issues/493", "id": 1130876857, "node_id": "IC_kwDODwFebM5DZ8-5", "user": { "login": "octocat", "id": 94867353, "node_id": "U_kgDOBaePmQ", "avatar_url": "https://avatars.githubusercontent.com/u/94867353?v=4", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": true }, "created_at": "2022-05-19T00:52:15Z", "updated_at": "2022-05-19T00:52:15Z", "author_association": "COLLABORATOR", "body": "🚢 Shipped to the cloud: https://github.blog/changelog/2022-05-12-secret-scanning-dry-runs-for-enterprise-level-custom-patterns/", "reactions": { "url": "https://HOSTNAME/repos/github/roadmap/issues/comments/1130876857/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null, "event": "commented", "actor": { "login": "octocat", "id": 94867353, "node_id": "U_kgDOBaePmQ", "avatar_url": "https://avatars.githubusercontent.com/u/94867353?v=4", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": true } } ]