我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

此版本的 GitHub Enterprise 已停止服务 2020-11-12. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

关于 web 挂钩

Learn the basics of how webhooks work to help you build and set up integrations.

本文内容

Webhooks allow you to build or set up integrations, such as GitHub 应用程序s or OAuth 应用程序s, which subscribe to certain events on GitHub.com. When one of those events is triggered, we'll send a HTTP POST payload to the webhook's configured URL. Webhooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server. You're only limited by your imagination.

Webhooks can be installed on GitHub Enterprise, an organization, a specific repository, or a GitHub 应用程序. Once installed, the webhook will be sent each time one or more subscribed events occurs.

You can create up to 250 webhooks for each event on each installation target (GitHub Enterprise Server instance, specific organization, or specific repository).

事件

配置 web 挂钩时,您可以使用 UI 或 API 选择哪些事件将向您发送有效负载。 仅订阅您计划处理的特定事件可限制对服务器的 HTTP 请求数。 您也可以订阅所有当前和未来的事件。 默认情况下,web 挂钩只订阅推送事件。 您可以随时更改订阅事件的列表。

Each event corresponds to a certain set of actions that can happen to your organization and/or repository. For example, if you subscribe to the issues event you'll receive detailed payloads every time an issue is opened, closed, labeled, etc.

See "Webhook event payloads" for the list of available webhook events and their payloads.

Ping event

当您创建新的 web 挂钩时,我们将向您发送一个简单的 ping 事件,让您知道您已正确设置 web 挂钩。 This event isn't stored so it isn't retrievable via the Events API endpoint.

For more information about the ping event webhook payload, see the ping event.