diff --git a/cloudevents/adapters/github.md b/cloudevents/adapters/github.md index f533643c4..30df32991 100644 --- a/cloudevents/adapters/github.md +++ b/cloudevents/adapters/github.md @@ -1,15 +1,45 @@ # GitHub CloudEvents Adapter This document describes how to convert -[GitHub webhook events](https://developer.github.com/v3/activity/events/types/) +[GitHub webhook events](https://docs.github.com/en/webhooks/webhook-events-and-payloads) into a CloudEvents. GitHub webhook event documentation: -https://developer.github.com/v3/activity/events/types/ +https://docs.github.com/en/webhooks/webhook-events-and-payloads Each section below describes how to determine the CloudEvents attributes based on the specified event. +### BranchProtectionConfigurationEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.branch_protection_configuration.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | Omit | +| `time` | Current time | +| `data` | Content of HTTP request body | + +### BranchProtectionRuleEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :---------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.branch_protection_rule.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "rule.id" value | +| `time` | "rule.updated_at" value | +| `data` | Content of HTTP request body | + ### CheckRunEvent | CloudEvents Attribute | Value | @@ -40,6 +70,21 @@ based on the specified event. | `time` | "check_suite.updated_at" value | | `data` | Content of HTTP request body | +### CodeScanningAlertEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.code_scanning_alert.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "alert.number" value | +| `time` | Current time | +| `data` | Content of HTTP request body | + ### CommitCommentEvent | CloudEvents Attribute | Value | @@ -85,6 +130,36 @@ based on the specified event. | `time` | Current time | | `data` | Content of HTTP request body | +### CustomPropertyEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :--------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.custom_property.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "definition.property_name" value | +| `time` | Current time | +| `data` | Content of HTTP request body | + +### CustomPropertyValuesEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :---------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.custom_property_values.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | Omit | +| `time` | Current time | +| `data` | Content of HTTP request body | + ### DeleteEvent | CloudEvents Attribute | Value | @@ -100,6 +175,21 @@ based on the specified event. | `time` | Current time | | `data` | Content of HTTP request body | +### DependabotAlertEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :---------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.dependabot_alert.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "alert.id" value | +| `time` | Current time | +| `data` | Content of HTTP request body | + ### DeployKeyEvent | CloudEvents Attribute | Value | @@ -130,6 +220,36 @@ based on the specified event. | `time` | "deployment.updated_at" value | | `data` | Content of HTTP request body | +### DeploymentProtectionRuleEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :-------------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "deployment.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.deployment_protection_rule.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "deployment.id" value if exists | +| `time` | Current time | +| `data` | Content of HTTP request body | + +### DeploymentReviewEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :----------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "deployment.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.deployment_review.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "workflow_run.id" value | +| `time` | Current time | +| `data` | Content of HTTP request body | + ### DeploymentStatusEvent | CloudEvents Attribute | Value | @@ -145,6 +265,36 @@ based on the specified event. | `time` | "deployment_status.updated_at" value | | `data` | Content of HTTP request body | +### DiscussionEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :---------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.discussion.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | "discussion.updated_at" value | +| `subject` | "discussion.id" value | +| `time` | Current time | +| `data` | Content of HTTP request body | + +### DiscussionCommentEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------------ | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.discussion_comment.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "discussion.id" value | +| `time` | "comment.updated_at" value | +| `data` | Content of HTTP request body | + ### ForkEvent | CloudEvents Attribute | Value | @@ -177,18 +327,18 @@ based on the specified event. ### GollumEvent -| CloudEvents Attribute | Value | -| :-------------------- | :------------------------------------------ | -| `id` | "X-GitHub-Delivery" HTTP header value | -| `source` | "repository.url" value | -| `specversion` | `1.0` | -| `type` | `com.github.gollum.` + "pages.action" value | -| `datacontentencoding` | Omit | -| `datacontenttype` | `application/json` | -| `dataschema` | Omit | -| `subject` | "pages.page_name" value | -| `time` | Current time | -| `data` | Content of HTTP request body | +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------ | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.gollum` | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | Omit | +| `time` | Current time | +| `data` | Content of HTTP request body | ### InstallationEvent @@ -207,18 +357,33 @@ based on the specified event. ### InstallationRepositoryEvent -| CloudEvents Attribute | Value | -| :-------------------- | :----------------------------------------------------- | -| `id` | "X-GitHub-Delivery" HTTP header value | -| `source` | "installation.account.url" value | -| `specversion` | `1.0` | -| `type` | `com.github.installation_repository.` + "action" value | -| `datacontentencoding` | Omit | -| `datacontenttype` | `application/json` | -| `dataschema` | Omit | -| `subject` | "installation.id" value | -| `time` | "installation.updated_at" value # not a timestamp?? | -| `data` | Content of HTTP request body | +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "installation.account.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.installation_repositories.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "installation.id" value | +| `time` | "installation.updated_at" value | +| `data` | Content of HTTP request body | + +### InstallationTargetEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "installation.account.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.installation_target.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "installation.id" value | +| `time` | Current time | +| `data` | Content of HTTP request body | ### IssueCommentEvent @@ -242,7 +407,7 @@ based on the specified event. | `id` | "X-GitHub-Delivery" HTTP header value | | `source` | "repository.url" value | | `specversion` | `1.0` | -| `type` | `com.github.issue.` + "action" value | +| `type` | `com.github.issues.` + "action" value | | `datacontentencoding` | Omit | | `datacontenttype` | `application/json` | | `dataschema` | Omit | @@ -310,6 +475,21 @@ based on the specified event. | `time` | Current time | | `data` | Content of HTTP request body | +### MergeGroupEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :----------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.merge_group.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "merge_group.head_ref" value | +| `time` | Current time | +| `data` | Content of HTTP request body | + ### MetaEvent | CloudEvents Attribute | Value | @@ -370,6 +550,21 @@ based on the specified event. | `time` | Current time | | `data` | Content of HTTP request body | +### PackageEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.package.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "package.id" value | +| `time` | "package.(updated\|created)\_at" value | +| `data` | Content of HTTP request body | + ### PageBuildEvent | CloudEvents Attribute | Value | @@ -430,6 +625,51 @@ based on the specified event. | `time` | "project.updated_at" value | | `data` | Content of HTTP request body | +### ProjectsV2Event + +| CloudEvents Attribute | Value | +| :-------------------- | :----------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.projects_v2.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "projects_v2.id" value | +| `time` | "projects_v2.updated_at" value | +| `data` | Content of HTTP request body | + +### ProjectsV2ItemEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :---------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.projects_v2_item.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "projects_v2_item.id" value | +| `time` | "projects_v2_item.updated_at" value | +| `data` | Content of HTTP request body | + +### ProjectsV2StatusUpdateEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.projects_v2_status_update.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "projects_v2_status_update.id" value | +| `time` | "projects_v2_status_update.updated_at" value | +| `data` | Content of HTTP request body | + ### PublicEvent | CloudEvents Attribute | Value | @@ -490,6 +730,21 @@ based on the specified event. | `time` | "pull_request.updated_at" value | | `data` | Content of HTTP request body | +### PullRequestReviewThreadEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :-------------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "pull_request.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.pull_request_review_thread.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "pull_request.id" value | +| `time` | Current time | +| `data` | Content of HTTP request body | + ### PushEvent | CloudEvents Attribute | Value | @@ -550,6 +805,36 @@ based on the specified event. | `time` | "repository.updated_at" value | | `data` | Content of HTTP request body | +### RepositoryAdvisoryEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.repository_advisory.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "repository_advisory.ghsa_id" value | +| `time` | "repository_advisory.updated_at" value | +| `data` | Content of HTTP request body | + +### RepositoryDispatchEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------------ | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.owner.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.repository_dispatch` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | Omit | +| `time` | Current time | +| `data` | Content of HTTP request body | + ### RepositoryImportEvent | CloudEvents Attribute | Value | @@ -565,6 +850,21 @@ based on the specified event. | `time` | "repository.updated_at" value | | `data` | Content of HTTP request body | +### RepositoryRulesetEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :----------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.owner.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.repository_ruleset` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "repository.name" value | +| `time` | "repository.updated_at" value | +| `data` | Content of HTTP request body | + ### RepositoryVulnerabilityAlertEvent | CloudEvents Attribute | Value | @@ -580,6 +880,36 @@ based on the specified event. | `time` | Current time # repository.updated_id ? | | `data` | Content of HTTP request body | +### SecretScanningAlertEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :--------------------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.secret_scanning_alert.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "alert.number" value | +| `time` | "alert.updated_at" value or "alert.created_at" | +| `data` | Content of HTTP request body | + +### SecretScanningAlertLocationEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------------------------ | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.secret_scanning_alert_location.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "alert.number" value | +| `time` | "alert.updated_at" value or "alert.created_at" | +| `data` | Content of HTTP request body | + ### SecurityAdvisoryEvent | CloudEvents Attribute | Value | @@ -595,6 +925,36 @@ based on the specified event. | `time` | "security_advisory.updated_at" value | | `data` | Content of HTTP request body | +### SecurityAndAnalysisEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------ | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.security_and_analysis` | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | Omit | +| `time` | Current time | +| `data` | Content of HTTP request body | + +### SponsorshipEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :----------------------------------------- | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.sponsorship.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "sponsorship.sponsor.login" | +| `time` | Current time | +| `data` | Content of HTTP request body | + ### StarEvent | CloudEvents Attribute | Value | @@ -670,3 +1030,47 @@ based on the specified event. | `time` | Current time | | `data` | Content of HTTP request body | +### WorkflowDispatchEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------ | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.workflow_dispatch` | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "workflow" value | +| `time` | Current time | +| `data` | Content of HTTP request body | + +### WorkflowJobEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------ | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.workflow_job.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "workflow_job.name" value | +| `time` | Current time | +| `data` | Content of HTTP request body | + +### WorkflowRunEvent + +| CloudEvents Attribute | Value | +| :-------------------- | :------------------------------------------ | +| `id` | "X-GitHub-Delivery" HTTP header value | +| `source` | "repository.url" value | +| `specversion` | `1.0` | +| `type` | `com.github.workflow_run.` + "action" value | +| `datacontentencoding` | Omit | +| `datacontenttype` | `application/json` | +| `dataschema` | Omit | +| `subject` | "workflow.name" value | +| `time` | Current time | +| `data` | Content of HTTP request body |