1
0
mirror of synced 2025-12-21 10:57:10 -05:00

GHEC version (#20947)

Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com>
Co-authored-by: Grace Park <gracepark@github.com>
Co-authored-by: Steve Guntrip <12534592+stevecat@users.noreply.github.com>
Co-authored-by: Robert Sese <sese@github.com>
Co-authored-by: Peter Bengtsson <peterbe@github.com>
Co-authored-by: Rachael Sewell <rachmari@github.com>
This commit is contained in:
Laura Coursen
2021-10-15 15:41:33 -05:00
committed by GitHub
parent be8cb7cb8c
commit 8f964ea2cb
1592 changed files with 4984 additions and 3494 deletions

View File

@@ -9,12 +9,13 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Events
---
The Events API can return different types of events triggered by activity on GitHub. Each event response contains shared properties, but has a unique `payload` object determined by its event type. The [Event object common properties](#event-object-common-properties) describes the properties shared by all events, and each event type describes the `payload` properties that are unique to the specific event.
{% ifversion fpt %}
{% ifversion fpt or ghec %}
{% endif %}
@@ -163,7 +164,7 @@ Link: <https://api.github.com/resource?page=2>; rel="next",
{% data reusables.webhooks.member_event_api_properties %}
{% data reusables.webhooks.member_properties %}
{% ifversion fpt or ghes %}
{% ifversion fpt or ghes or ghec %}
## PublicEvent
{% data reusables.webhooks.public_short_desc %}
@@ -243,7 +244,7 @@ Key | Type | Description
{% data reusables.webhooks.release_event_api_properties %}
{% data reusables.webhooks.release_properties %}
{% ifversion fpt %}
{% ifversion fpt or ghec %}
## SponsorshipEvent
{% data reusables.webhooks.sponsorship_short_desc %}

View File

@@ -5,6 +5,7 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Events
children:

View File

@@ -8,6 +8,7 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Events
---
@@ -130,7 +131,7 @@ Name | Type | Description
`html_url` | `string` | The HTML URL of the issue comment.
`issue_url` | `string` | The HTML URL of the issue.
`id` | `integer` | The unique identifier of the event.
`node_id` | `string` | The [Global Node ID](/graphql/guides/using-global-node-ids) of the event.
`node_id` | `string` | The [Global Node ID]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-global-node-ids) of the event.
`user` | `object` | The person who commented on the issue.
`created_at` | `string` | The timestamp indicating when the comment was added.
`updated_at` | `string` | The timestamp indicating when the comment was updated or created, if the comment is never updated.
@@ -156,7 +157,7 @@ A commit was added to the pull request's `HEAD` branch.
Name | Type | Description
-----|------|--------------
`sha` | `string` | The SHA of the commit in the pull request.
`node_id` | `string` | The [Global Node ID](/graphql/guides/using-global-node-ids) of the event.
`node_id` | `string` | The [Global Node ID]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-global-node-ids) of the event.
`url` | `string` | The REST API URL to retrieve the commit.
`html_url` | `string` | The HTML URL of the commit.
`author` | `object` | The person who authored the commit.
@@ -583,7 +584,7 @@ The pull request was reviewed.
Name | Type | Description
-----|------|--------------
`id` | `integer` | The unique identifier of the event.
`node_id` | `string` | The [Global Node ID](/graphql/guides/using-global-node-ids) of the event.
`node_id` | `string` | The [Global Node ID]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-global-node-ids) of the event.
`user` | `object` | The person who commented on the issue.
`body` | `string` | The review summary text.
`commit_id` | `string` | The SHA of the latest commit in the pull request at the time of the review.
@@ -710,7 +711,7 @@ Someone unsubscribed from receiving notifications for an issue or pull request.
{% data reusables.issue-events.issue-event-common-properties %}
{% ifversion fpt %}
{% ifversion fpt or ghec %}
## user_blocked
An organization owner blocked a user from the organization. This was done [through one of the blocked user's comments on the issue](/communities/maintaining-your-safety-on-github/blocking-a-user-from-your-organization#blocking-a-user-in-a-comment).

View File

@@ -5,6 +5,7 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Webhooks
- Events

View File

@@ -8,6 +8,7 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Webhooks
---

View File

@@ -8,6 +8,7 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Webhooks
shortTitle: Configure server for webhooks

View File

@@ -8,6 +8,7 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Webhooks
---

View File

@@ -5,6 +5,7 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Webhooks
children:

View File

@@ -8,6 +8,7 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Webhooks
---
@@ -36,9 +37,9 @@ $ export SECRET_TOKEN=<em>your_token</em>
## Validating payloads from GitHub
When your secret token is set, {% data variables.product.product_name %} uses it to create a hash signature with each payload. This hash signature is included with the headers of each request as {% ifversion fpt or ghes > 2.22 or ghae %}`X-Hub-Signature-256`{% elsif ghes < 3.0 %}`X-Hub-Signature`{% endif %}.
When your secret token is set, {% data variables.product.product_name %} uses it to create a hash signature with each payload. This hash signature is included with the headers of each request as {% ifversion fpt or ghes > 2.22 or ghae or ghec %}`X-Hub-Signature-256`{% elsif ghes < 3.0 %}`X-Hub-Signature`{% endif %}.
{% ifversion fpt or ghes > 2.22 %}
{% ifversion fpt or ghes > 2.22 or ghec %}
{% note %}
**Note:** For backward-compatibility, we also include the `X-Hub-Signature` header that is generated using the SHA-1 hash function. If possible, we recommend that you use the `X-Hub-Signature-256` header for improved security. The example below demonstrates using the `X-Hub-Signature-256` header.
@@ -70,7 +71,7 @@ post '/payload' do
"I got some JSON: #{push.inspect}"
end
{% ifversion fpt or ghes > 2.22 or ghae %}
{% ifversion fpt or ghes > 2.22 or ghae or ghec %}
def verify_signature(payload_body)
signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), ENV['SECRET_TOKEN'], payload_body)
return halt 500, "Signatures didn't match!" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE_256'])
@@ -89,7 +90,7 @@ end{% endif %}
Your language and server implementations may differ from this example code. However, there are a number of very important things to point out:
* No matter which implementation you use, the hash signature starts with {% ifversion fpt or ghes > 2.22 or ghae %}`sha256=`{% elsif ghes < 3.0 %}`sha1=`{% endif %}, using the key of your secret token and your payload body.
* No matter which implementation you use, the hash signature starts with {% ifversion fpt or ghes > 2.22 or ghae or ghec %}`sha256=`{% elsif ghes < 3.0 %}`sha1=`{% endif %}, using the key of your secret token and your payload body.
* Using a plain `==` operator is **not advised**. A method like [`secure_compare`][secure_compare] performs a "constant time" string comparison, which helps mitigate certain timing attacks against regular equality operators.

View File

@@ -8,6 +8,7 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Webhooks
---
@@ -19,7 +20,7 @@ view provides some tooling for testing your deployed payloads.
Every webhook has its own "Recent Deliveries" section, which lists, at a glance whether a delivery was successful (green check) or failed (red x). You can also identify when each delivery was attempted.
{% data variables.product.product_name %} keeps a log of each webhook delivery for {% ifversion fpt %} 30 {% else %} 8 {% endif %} days.
{% data variables.product.product_name %} keeps a log of each webhook delivery for {% ifversion fpt or ghec %} 30 {% else %} 8 {% endif %} days.
![Recent Deliveries view](/assets/images/webhooks_recent_deliveries.png)

View File

@@ -11,11 +11,12 @@ versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
topics:
- Webhooks
shortTitle: Webhook events & payloads
---
{% ifversion fpt %}
{% ifversion fpt or ghec %}
{% endif %}
@@ -53,7 +54,7 @@ Header | Description
`X-GitHub-Delivery`| A [GUID](http://en.wikipedia.org/wiki/Globally_unique_identifier) to identify the delivery.{% ifversion ghes or ghae %}
`X-GitHub-Enterprise-Version` | The version of the {% data variables.product.prodname_ghe_server %} instance that sent the HTTP POST payload.
`X-GitHub-Enterprise-Host` | The hostname of the {% data variables.product.prodname_ghe_server %} instance that sent the HTTP POST payload.{% endif %}{% ifversion not ghae %}
`X-Hub-Signature`| This header is sent if the webhook is configured with a [`secret`](/rest/reference/repos#create-hook-config-params). This is the HMAC hex digest of the request body, and is generated using the SHA-1 hash function and the `secret` as the HMAC `key`.{% ifversion fpt or ghes > 2.22 %} `X-Hub-Signature` is provided for compatibility with existing integrations, and we recommend that you use the more secure `X-Hub-Signature-256` instead.{% endif %}{% endif %}{% ifversion fpt or ghes > 2.22 or ghae %}
`X-Hub-Signature`| This header is sent if the webhook is configured with a [`secret`](/rest/reference/repos#create-hook-config-params). This is the HMAC hex digest of the request body, and is generated using the SHA-1 hash function and the `secret` as the HMAC `key`.{% ifversion fpt or ghes > 2.22 or ghec %} `X-Hub-Signature` is provided for compatibility with existing integrations, and we recommend that you use the more secure `X-Hub-Signature-256` instead.{% endif %}{% endif %}{% ifversion fpt or ghes > 2.22 or ghae or ghec %}
`X-Hub-Signature-256`| This header is sent if the webhook is configured with a [`secret`](/rest/reference/repos#create-hook-config-params). This is the HMAC hex digest of the request body, and is generated using the SHA-256 hash function and the `secret` as the HMAC `key`.{% endif %}
Also, the `User-Agent` for the requests will have the prefix `GitHub-Hookshot/`.
@@ -67,7 +68,7 @@ Also, the `User-Agent` for the requests will have the prefix `GitHub-Hookshot/`.
> X-GitHub-Delivery: 72d3162e-cc78-11e3-81ab-4c9367dc0958{% ifversion ghes or ghae %}
> X-GitHub-Enterprise-Version: 2.15.0
> X-GitHub-Enterprise-Host: example.com{% endif %}{% ifversion not ghae %}
> X-Hub-Signature: sha1=7d38cdd689735b008b3c702edd92eea23791c5f6{% endif %}{% ifversion fpt or ghes > 2.22 or ghae %}
> X-Hub-Signature: sha1=7d38cdd689735b008b3c702edd92eea23791c5f6{% endif %}{% ifversion fpt or ghes > 2.22 or ghae or ghec %}
> X-Hub-Signature-256: sha256=d57c68ca6f92289e6987922ff26938930f6e66a2d161ef06abdf1859230aa23c{% endif %}
> User-Agent: GitHub-Hookshot/044aadd
> Content-Type: application/json
@@ -99,7 +100,7 @@ Also, the `User-Agent` for the requests will have the prefix `GitHub-Hookshot/`.
> }
```
{% ifversion fpt or ghes > 3.2 or ghae-next %}
{% ifversion fpt or ghes > 3.2 or ghae-next or ghec %}
## branch_protection_rule
Activity related to a branch protection rule. For more information, see "[About branch protection rules](/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#about-branch-protection-rules)."
@@ -189,7 +190,7 @@ Key | Type | Description
{% data reusables.webhooks.repo_desc %}
{% data reusables.webhooks.org_desc %}
{% data reusables.webhooks.app_desc %}
`sender` | `object` | If the `action` is `reopened_by_user` or `closed_by_user`, the `sender` object will be the user that triggered the event. The `sender` object is {% ifversion fpt %}`github`{% elsif ghes > 3.0 or ghae-next %}`github-enterprise`{% else %}empty{% endif %} for all other actions.
`sender` | `object` | If the `action` is `reopened_by_user` or `closed_by_user`, the `sender` object will be the user that triggered the event. The `sender` object is {% ifversion fpt or ghec %}`github`{% elsif ghes > 3.0 or ghae-next %}`github-enterprise`{% else %}empty{% endif %} for all other actions.
### Webhook payload example
@@ -322,7 +323,7 @@ Webhook events are triggered based on the specificity of the domain you register
### Webhook payload object
Key | Type | Description
----|------|-------------{% ifversion fpt or ghes or ghae %}
----|------|-------------{% ifversion fpt or ghes or ghae or ghec %}
`action` |`string` | The action performed. Can be `created`.{% endif %}
`deployment` |`object` | The [deployment](/rest/reference/repos#list-deployments).
{% data reusables.webhooks.repo_desc %}
@@ -347,7 +348,7 @@ Key | Type | Description
### Webhook payload object
Key | Type | Description
----|------|-------------{% ifversion fpt or ghes or ghae %}
----|------|-------------{% ifversion fpt or ghes or ghae or ghec %}
`action` |`string` | The action performed. Can be `created`.{% endif %}
`deployment_status` |`object` | The [deployment status](/rest/reference/repos#list-deployment-statuses).
`deployment_status["state"]` |`string` | The new state. Can be `pending`, `success`, `failure`, or `error`.
@@ -363,12 +364,12 @@ Key | Type | Description
{{ webhookPayloadsForCurrentVersion.deployment_status }}
{% ifversion fpt %}
{% ifversion fpt or ghec %}
## discussion
{% data reusables.webhooks.discussions-webhooks-beta %}
Activity related to a discussion. For more information, see the "[Using the GraphQL API for discussions](/graphql/guides/using-the-graphql-api-for-discussions)."
Activity related to a discussion. For more information, see the "[Using the GraphQL API for discussions]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-the-graphql-api-for-discussions)."
### Availability
- Repository webhooks
@@ -393,7 +394,7 @@ Key | Type | Description
{% data reusables.webhooks.discussions-webhooks-beta %}
Activity related to a comment in a discussion. For more information, see "[Using the GraphQL API for discussions](/graphql/guides/using-the-graphql-api-for-discussions)."
Activity related to a comment in a discussion. For more information, see "[Using the GraphQL API for discussions]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-the-graphql-api-for-discussions)."
### Availability
@@ -406,7 +407,7 @@ Activity related to a comment in a discussion. For more information, see "[Using
Key | Type | Description
----|------|-------------
`action` |`string` | The action performed. Can be `created`, `edited`, or `deleted`.
`comment` | `object` | The [`discussion comment`](/graphql/guides/using-the-graphql-api-for-discussions#discussioncomment) resource.
`comment` | `object` | The [`discussion comment`]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-the-graphql-api-for-discussions#discussioncomment) resource.
{% data reusables.webhooks.discussion_desc %}
{% data reusables.webhooks.repo_desc_graphql %}
{% data reusables.webhooks.org_desc_graphql %}
@@ -614,7 +615,7 @@ Key | Type | Description
{{ webhookPayloadsForCurrentVersion.label.deleted }}
{% ifversion fpt %}
{% ifversion fpt or ghec %}
## marketplace_purchase
Activity related to a GitHub Marketplace purchase. {% data reusables.webhooks.action_type_desc %} For more information, see the "[GitHub Marketplace](/marketplace/)."
@@ -752,7 +753,7 @@ Key | Type | Description
{{ webhookPayloadsForCurrentVersion.organization.member_added }}
{% ifversion fpt %}
{% ifversion fpt or ghec %}
## org_block
@@ -779,7 +780,7 @@ Key | Type | Description
{% endif %}
{% ifversion fpt or ghae %}
{% ifversion fpt or ghae or ghec %}
## package
@@ -919,7 +920,7 @@ Key | Type | Description
{{ webhookPayloadsForCurrentVersion.project.created }}
{% ifversion fpt or ghes %}
{% ifversion fpt or ghes or ghec %}
## public
{% data reusables.webhooks.public_short_desc %}
@@ -1085,7 +1086,7 @@ Key | Type | Description
{{ webhookPayloadsForCurrentVersion.release.published }}
{% ifversion fpt or ghes or ghae %}
{% ifversion fpt or ghes or ghae or ghec %}
## repository_dispatch
This event occurs when a {% data variables.product.prodname_github_app %} sends a `POST` request to the "[Create a repository dispatch event](/rest/reference/repos#create-a-repository-dispatch-event)" endpoint.
@@ -1123,7 +1124,7 @@ Key | Type | Description
{{ webhookPayloadsForCurrentVersion.repository.publicized }}
{% ifversion fpt %}
{% ifversion fpt or ghec %}
## repository_import
{% data reusables.webhooks.repository_import_short_desc %} To receive this event for a personal repository, you must create an empty repository prior to the import. This event can be triggered using either the [GitHub Importer](/articles/importing-a-repository-with-github-importer/) or the [Source imports API](/rest/reference/migrations#source-imports).
@@ -1166,7 +1167,7 @@ Key | Type | Description
{% endif %}
{% ifversion fpt or ghes > 3.0 %}
{% ifversion fpt or ghes > 3.0 or ghec %}
## secret_scanning_alert
@@ -1191,7 +1192,7 @@ Key | Type | Description
{{ webhookPayloadsForCurrentVersion.secret_scanning_alert.reopened }}
{% endif %}
{% ifversion fpt or ghes %}
{% ifversion fpt or ghes or ghec %}
## security_advisory
Activity related to a security advisory. A security advisory provides information about security-related vulnerabilities in software on GitHub. The security advisory dataset also powers the GitHub security alerts, see "[About alerts for vulnerable dependencies](/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies/)."
@@ -1212,7 +1213,7 @@ Key | Type | Description
{{ webhookPayloadsForCurrentVersion.security_advisory.published }}
{% ifversion fpt %}
{% ifversion fpt or ghec %}
## sponsorship
{% data reusables.webhooks.sponsorship_short_desc %}
@@ -1381,7 +1382,7 @@ The events actor is the [user](/rest/reference/users) who starred a repositor
{{ webhookPayloadsForCurrentVersion.watch.started }}
{% ifversion fpt or ghes %}
{% ifversion fpt or ghes or ghec %}
## workflow_dispatch
This event occurs when someone triggers a workflow run on GitHub or sends a `POST` request to the "[Create a workflow dispatch event](/rest/reference/actions/#create-a-workflow-dispatch-event)" endpoint. For more information, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)."
@@ -1395,7 +1396,7 @@ This event occurs when someone triggers a workflow run on GitHub or sends a `POS
{{ webhookPayloadsForCurrentVersion.workflow_dispatch }}
{% endif %}
{% ifversion fpt or ghes > 3.2 %}
{% ifversion fpt or ghes > 3.2 or ghec %}
## workflow_job
@@ -1419,7 +1420,7 @@ This event occurs when someone triggers a workflow run on GitHub or sends a `POS
{{ webhookPayloadsForCurrentVersion.workflow_job }}
{% endif %}
{% ifversion fpt or ghes > 2.22 %}
{% ifversion fpt or ghes > 2.22 or ghec %}
## workflow_run
When a {% data variables.product.prodname_actions %} workflow run is requested or completed. For more information, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_run)."