Сведения о событиях и полезных данных веб-перехватчика
Вы можете создавать веб-перехватчики, которые подписываются на события, указанные на этой странице. Чтобы ограничить количество HTTP-запросов на сервер, следует подписаться только на определенные события, которые вы планируете обрабатывать. Дополнительные сведения см. в разделе Создание веб-перехватчиков.
Каждое событие веб-перехватчика на этой странице содержит описание свойств веб-перехватчика для этого события. Если событие имеет несколько действий, будут включены свойства, соответствующие каждому действию.
Каждое событие доступно только для определенных типов веб-перехватчиков. Например, веб-перехватчик организации может подписаться на team событие, но веб-перехватчик репозитория не может. Описание каждого события веб-перехватчика содержит сведения о доступности этого события. Дополнительные сведения см. в разделе Типы веб-перехватчиков.
Свойство sender
Большинство полезных данных веб-перехватчика включают sender свойство, определяющее пользователя, активировавшего событие. Иногда GitHub не удается разрешить определенного пользователя, например, когда событие происходит из внутреннего процесса, а не человека, или когда действие активации не имеет связанного пользователя. Для некоторых событий, таких как check_run и check_suite, это включает действия без принудительной отправки или проверки подлинности субъекта API Git.
В таких случаях sender пользователь заполняется ghostучетной записью заполнителя, чья login``ghost``id учетная запись не связана с реальным текущим пользователем. Не предполагайте sender всегда идентифицирует пользователя, вызвавшего событие, и учетную запись ghost пользователя в любой безопасности или бизнес-логике, которая зависит от него.
Крышка полезных данных
Полезные данные ограничены размером 25 МБ. Если событие создает большую полезные данные, GitHub не будет доставлять полезные данные для этого события веб-перехватчика. Это может произойти, например, при событии create в случае одновременной принудительной отправки большого количества ветвей или тегов. Рекомендуем отслеживать размер полезных данных, чтобы обеспечить доставку.
Заголовки доставки
Полезные данные HTTP POST, которые доставляются на настроенную конечную точку URL-адреса вашего веб-перехватчика, будут содержать несколько специальных заголовков:
X-GitHub-Hook-ID: Уникальный идентификатор вебхука.X-GitHub-Event: Название события, которое вызвало доставку.X-GitHub-Delivery: глобальный уникальный идентификатор (GUID) для идентификации события.X-Hub-Signature: этот заголовок отправляется, если веб-перехватчик настроен с помощьюsecret. Это хэш-хэш HMAC текста запроса и создается с помощью хэш-функции SHA-1 иsecretHMACkey.X-Hub-Signatureпредоставляется для обеспечения совместимости с существующими интеграциями. Вместо этого рекомендуется использовать более безопасныйX-Hub-Signature-256вариант.X-Hub-Signature-256: этот заголовок отправляется, если веб-перехватчик настроен с помощьюsecret. Это шестнадцатеричный дайджест HMAC текста запроса, который генерируется с использованием хэш-функции SHA-256 иsecretв качестве HMACkey. Дополнительные сведения см. в разделе Проверка доставки веб-перехватчика.User-Agent: Этот заголовок всегда будет иметь префиксGitHub-Hookshot/.X-GitHub-Hook-Installation-Target-Type: тип ресурса, на котором был создан вебхук.X-GitHub-Hook-Installation-Target-ID: Уникальный идентификатор ресурса, по которому был создан вебхук.
Чтобы узнать, как выглядит каждый заголовок в полезных данных веб-перехватчика, см. пример доставки веб-перехватчика.
Пример доставки веб-перехватчика
Полезные данные, доставленные в формате JSON () или в формате URL-адреса (application/json``x-www-form-urlencoded). Ниже приведен пример запроса POST веб-перехватчика, использующего формат JSON.
> POST /payload HTTP/1.1
> X-GitHub-Delivery: 72d3162e-cc78-11e3-81ab-4c9367dc0958
> X-Hub-Signature: sha1=7d38cdd689735b008b3c702edd92eea23791c5f6
> X-Hub-Signature-256: sha256=d57c68ca6f92289e6987922ff26938930f6e66a2d161ef06abdf1859230aa23c
> User-Agent: GitHub-Hookshot/044aadd
> Content-Type: application/json
> Content-Length: 6615
> X-GitHub-Event: issues
> X-GitHub-Hook-ID: 292430182
> X-GitHub-Hook-Installation-Target-ID: 79929171
> X-GitHub-Hook-Installation-Target-Type: repository
> {
> "action": "opened",
> "issue": {
> "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
> "number": 1347,
> ...
> },
> "repository" : {
> "id": 1296269,
> "full_name": "octocat/Hello-World",
> "owner": {
> "login": "octocat",
> "id": 1,
> ...
> },
> ...
> },
> "sender": {
> "login": "octocat",
> "id": 1,
> ...
> }
> }
branch_protection_configuration
This event occurs when there is a change to branch protection configurations for a repository. For more information, see "About protected branches." For information about using the APIs to manage branch protection rules, see "Branch protection rule" in the GraphQL documentation or "Branch protection" in the REST API documentation.
To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission.
Доступность для branch_protection_configuration
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для branch_protection_configuration
All branch protections were disabled for a repository.
| Имя., Тип, Description |
|---|
action string Обязательное полезначение: |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
branch_protection_rule
This event occurs when there is activity relating to branch protection rules. For more information, see "About protected branches." For information about the APIs to manage branch protection rules, see the GraphQL documentation or "Branch protection" in the REST API documentation.
To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission.
Доступность для branch_protection_rule
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для branch_protection_rule
A branch protection rule was created.
| Имя., Тип, Description |
|---|
action string Обязательное полезначение: |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
rule object Обязательное полеThe branch protection rule. Includes a |
Properties of |
sender object Обязательное полеA GitHub user. |
check_run
This event occurs when there is activity relating to a check run. For information about check runs, see "Getting started with the Checks API." For information about the APIs to manage check runs, see the GraphQL API documentation or "Check Runs" in the REST API documentation.
For activity relating to check suites, use the check-suite event.
To subscribe to this event, a GitHub App must have at least read-level access for the "Checks" repository permission. To receive the rerequested and requested_action event types, the app must have at least write-level access for the "Checks" permission. GitHub Apps with write-level access for the "Checks" permission are automatically subscribed to this webhook event.
Repository and organization webhooks only receive payloads for the created and completed event types in repositories.
The API only looks for pushes in the repository where the check run was created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch.
Доступность для check_run
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для check_run
A check run was completed, and a conclusion is available.
| Имя., Тип, Description |
|---|
action string значение: |
check_run object Обязательное полеA check performed on the code of a given code change |
Properties of |
installation object The GitHub App installation. Webhook payloads contain the |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
check_suite
This event occurs when there is activity relating to a check suite. For information about check suites, see "Getting started with the Checks API." For information about the APIs to manage check suites, see the GraphQL API documentation or "Check Suites" in the REST API documentation.
For activity relating to check runs, use the check_run event.
To subscribe to this event, a GitHub App must have at least read-level access for the "Checks" permission. To receive the requested and rerequested event types, the app must have at least write-level access for the "Checks" permission. GitHub Apps with write-level access for the "Checks" permission are automatically subscribed to this webhook event.
Repository and organization webhooks only receive payloads for the completed event types in repositories.
The API only looks for pushes in the repository where the check suite was created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch.
Доступность для check_suite
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для check_suite
All check runs in a check suite have completed, and a conclusion is available.
| Имя., Тип, Description |
|---|
action string Обязательное полезначение: |
check_suite object Обязательное полеThe check_suite. |
Properties of |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
code_scanning_alert
This event occurs when there is activity relating to code scanning alerts in a repository. For more information, see "About code scanning" and "About code scanning alerts." For information about the API to manage code scanning, see "Code scanning" in the REST API documentation.
To subscribe to this event, a GitHub App must have at least read-level access for the "Code scanning alerts" repository permission.
Доступность для code_scanning_alert
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для code_scanning_alert
A previously created code scanning alert appeared in another branch. This can happen when a branch is merged into or created from a branch with a pre-existing code scanning alert.
| Имя., Тип, Description |
|---|
action string Обязательное полезначение: |
alert object Обязательное полеThe code scanning alert involved in the event. |
Properties of |
commit_oid string Обязательное полеThe commit SHA of the code scanning alert. When the action is |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
ref string Обязательное полеThe Git reference of the code scanning alert. When the action is |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
commit_comment
This event occurs when there is activity relating to commit comments. For more information about commit comments, see "Commenting on a pull request." For information about the APIs to manage commit comments, see the GraphQL API documentation or "Commit comments" in the REST API documentation.
For activity relating to comments on pull request reviews, use the pull_request_review_comment event. For activity relating to issue comments, use the issue_comment event. For activity relating to discussion comments, use the discussion_comment event.
To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission.
Доступность для commit_comment
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для commit_comment
Someone commented on a commit.
| Имя., Тип, Description |
|---|
action string Обязательное полеThe action performed. Can be значение: |
comment object Обязательное полеThe commit comment resource. |
Properties of |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
create
This event occurs when a Git branch or tag is created.
To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission.
Notes:
- This event will not occur when more than three tags are created at once.
- Payloads are capped at 25 MB. If an event generates a larger payload, GitHub will not deliver a payload for that webhook event. This may happen, for example, if many branches or tags are pushed at once. We suggest monitoring your payload size to ensure delivery.
Доступность для create
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для create
| Имя., Тип, Description |
|---|
description string or null Обязательное полеThe repository's current description. |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
master_branch string Обязательное полеThe name of the repository's default branch (usually |
organization object A GitHub organization. Webhook payloads contain the |
pusher_type string Обязательное полеThe pusher type for the event. Can be either |
ref string Обязательное полеThe |
ref_type string Обязательное полеThe type of Git ref object created in the repository. Возможные значения: |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
custom_property
This event occurs when there is activity relating to a custom property.
For more information, see "Managing custom properties for repositories in your organization". For information about the APIs to manage custom properties, see "Custom properties" in the REST API documentation.
To subscribe to this event, a GitHub App must have at least read-level access for the "Custom properties" organization permission.
Доступность для custom_property
- Предприятия
- Организации
- приложения GitHub
Объект полезных данных webhook для custom_property
A new custom property was created.
| Имя., Тип, Description |
|---|
action string Обязательное полезначение: |
definition object Обязательное полеCustom property defined on an organization |
Properties of |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
sender object A GitHub user. |
custom_property_values
This event occurs when there is activity relating to custom property values for a repository.
For more information, see "Managing custom properties for repositories in your organization". For information about the APIs to manage custom properties for a repository, see "Custom properties" in the REST API documentation.
To subscribe to this event, a GitHub App must have at least read-level access for the "Custom properties" organization permission.
Доступность для custom_property_values
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для custom_property_values
The custom property values of a repository were updated.
| Имя., Тип, Description |
|---|
action string Обязательное полезначение: |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
organization object Обязательное полеA GitHub organization. Webhook payloads contain the |
sender object A GitHub user. |
new_property_values array of objects Обязательное полеThe new custom property values for the repository. |
Properties of |
old_property_values array of objects Обязательное полеThe old custom property values for the repository. |
Properties of |
delete
This event occurs when a Git branch or tag is deleted. To subscribe to all pushes to a repository, including
branch and tag deletions, use the push webhook event.
To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission.
This event will not occur when more than three tags are deleted at once.
Доступность для delete
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для delete
| Имя., Тип, Description |
|---|
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
pusher_type string Обязательное полеThe pusher type for the event. Can be either |
ref string Обязательное полеThe |
ref_type string Обязательное полеThe type of Git ref object deleted in the repository. Возможные значения: |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
dependabot_alert
This event occurs when there is activity relating to Dependabot alerts.
For more information about Dependabot alerts, see "About Dependabot alerts." For information about the API to manage Dependabot alerts, see "Dependabot alerts" in the REST API documentation.
To subscribe to this event, a GitHub App must have at least read-level access for the "Dependabot alerts" repository permission.
Доступность для dependabot_alert
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для dependabot_alert
The assignees for a Dependabot alert were updated.
| Имя., Тип, Description |
|---|
action string Обязательное полезначение: |
alert object Обязательное полеA Dependabot alert. |
Properties of |
installation object The GitHub App installation. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
deploy_key
This event occurs when there is activity relating to deploy keys. For more information, see "Managing deploy keys." For information about the APIs to manage deploy keys, see the GraphQL API documentation or "Deploy keys" in the REST API documentation.
To subscribe to this event, a GitHub App must have at least read-level access for the "Deployments" repository permission.
Доступность для deploy_key
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для deploy_key
A deploy key was created.
| Имя., Тип, Description |
|---|
action string Обязательное полезначение: |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
key object Обязательное полеThe |
Properties of |
organization object A GitHub organization. Webhook payloads contain the |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
deployment
This event occurs when there is activity relating to deployments. For more information, see "About deployments." For information about the APIs to manage deployments, see the GraphQL API documentation or "Deployments" in the REST API documentation.
For activity relating to deployment status, use the deployment_status event.
To subscribe to this event, a GitHub App must have at least read-level access for the "Deployments" repository permission.
Доступность для deployment
- Репозитории
- Организации
- приложения GitHub
Объект полезных данных webhook для deployment
A deployment was created.
| Имя., Тип, Description |
|---|
action string Обязательное полезначение: |
deployment object Обязательное полеThe deployment. |
Properties of |
enterprise object An enterprise on GitHub. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
repository object Обязательное полеThe repository on GitHub where the event occurred. Webhook payloads contain the |
sender object Обязательное полеA GitHub user. |
workflow object or null Обязательное поле |
Properties of |
workflow_run object or null Обязательное поле |
Properties of |
deployment_protection_rule
This event occurs when there is activity relating to deployment protection rules. For more information, see "Using environments for deployment." For information about the API to manage deployment protection rules, see the REST API documentation.
To subscribe to this event, a GitHub App must have at least read-level access for the "Deployments" repository permission.
Доступность для deployment_protection_rule
- приложения GitHub
Объект полезных данных webhook для deployment_protection_rule
A deployment protection rule was requested for an environment.
| Имя., Тип, Description |
|---|
action string значение: |
environment string The name of the environment that has the deployment protection rule. |
event string The event that triggered the deployment protection rule. |
sha string The commit SHA that triggered the workflow. Always populated from the check suite, regardless of whether a deployment is created. |
ref string The ref (branch or tag) that triggered the workflow. Always populated from the check suite, regardless of whether a deployment is created. |
deployment_callback_url string The URL to review the deployment protection rule. |
deployment object or null A request for a specific ref(branch,sha,tag) to be deployed |
Properties of |
pull_requests array of objects |
Properties of |
repository object The repository on GitHub where the event occurred. Webhook payloads contain the |
organization object A GitHub organization. Webhook payloads contain the |
installation object The GitHub App installation. Webhook payloads contain the |
sender object A GitHub user. |
deployment_review
This event occurs when there is activity relating to deployment reviews. For more information, see "About deployments." For information about the APIs to manage deployments, see