From b2b91c597e0d9149ee93d6e381b18a96bda1eb2e Mon Sep 17 00:00:00 2001 From: Octokit Bot <33075676+octokitbot@users.noreply.github.com> Date: Wed, 24 Feb 2021 06:47:58 -0800 Subject: [PATCH] feat(typescript): new `deployment` object for CheckRunEvent #381 --- cache/webhook-events-and-payloads.html | 24 ++++++++++++- index.json | 34 +++++++++++++++++-- .../check_run/created.payload.json | 15 +++++++- .../schemas/check_run/completed.schema.json | 3 +- .../schemas/check_run/created.schema.json | 3 +- .../check_run/requested_action.schema.json | 3 +- .../schemas/check_run/rerequested.schema.json | 3 +- .../common/check-run-deployment.schema.json | 34 +++++++++++++++++++ schema.d.ts | 20 +++++++++++ 9 files changed, 131 insertions(+), 8 deletions(-) create mode 100644 payload-schemas/schemas/common/check-run-deployment.schema.json diff --git a/cache/webhook-events-and-payloads.html b/cache/webhook-events-and-payloads.html index a6d250b11..b6e852e79 100644 --- a/cache/webhook-events-and-payloads.html +++ b/cache/webhook-events-and-payloads.html @@ -571,6 +571,15 @@

empty. + + deployment + object + + A deployment to a repository environment. This will only be populated + if the check run was created by a GitHub Actions workflow job that + references an environment. + + requested_action object @@ -812,7 +821,20 @@

} } } - ] + ], + "deployment": { + "url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728", + "id": 326191728, + "node_id": "MDEwOkRlcGxveW1lbnQzMjYxOTE3Mjg=", + "task": "deploy", + "original_environment": "lab", + "environment": "lab", + "description": null, + "created_at": "2021-02-18T08:22:48Z", + "updated_at": "2021-02-18T09:47:16Z", + "statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728/statuses", + "repository_url": "https://api.github.com/repos/Codertocat/Hello-World" + } }, "repository": { "id": 186853002, diff --git a/index.json b/index.json index b6c0fe606..6882888c8 100644 --- a/index.json +++ b/index.json @@ -28,6 +28,10 @@ "type": "array", "description": "An array of pull requests that match this check suite. A pull request matches a check suite if they have the same `head_sha` and `head_branch`. When the check suite's `head_branch` is in a forked repository it will be `null` and the `pull_requests` array will be empty." }, + "deployment": { + "type": "object", + "description": "A deployment to a repository environment. This will only be populated if the check run was created by a GitHub Actions workflow job that references an environment." + }, "requested_action": { "type": "object", "description": "The action requested by the user." @@ -242,7 +246,20 @@ } } } - ] + ], + "deployment": { + "url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728", + "id": 326191728, + "node_id": "MDEwOkRlcGxveW1lbnQzMjYxOTE3Mjg=", + "task": "deploy", + "original_environment": "lab", + "environment": "lab", + "description": null, + "created_at": "2021-02-18T08:22:48Z", + "updated_at": "2021-02-18T09:47:16Z", + "statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728/statuses", + "repository_url": "https://api.github.com/repos/Codertocat/Hello-World" + } }, "repository": { "id": 186853002, @@ -1471,7 +1488,20 @@ } } } - ] + ], + "deployment": { + "url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728", + "id": 326191728, + "node_id": "MDEwOkRlcGxveW1lbnQzMjYxOTE3Mjg=", + "task": "deploy", + "original_environment": "lab", + "environment": "lab", + "description": null, + "created_at": "2021-02-18T08:22:48Z", + "updated_at": "2021-02-18T09:47:16Z", + "statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728/statuses", + "repository_url": "https://api.github.com/repos/Codertocat/Hello-World" + } }, "repository": { "id": 186853002, diff --git a/payload-examples/api.github.com/check_run/created.payload.json b/payload-examples/api.github.com/check_run/created.payload.json index 46e2bef04..415cda17b 100644 --- a/payload-examples/api.github.com/check_run/created.payload.json +++ b/payload-examples/api.github.com/check_run/created.payload.json @@ -186,7 +186,20 @@ } } } - ] + ], + "deployment": { + "url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728", + "id": 326191728, + "node_id": "MDEwOkRlcGxveW1lbnQzMjYxOTE3Mjg=", + "task": "deploy", + "original_environment": "lab", + "environment": "lab", + "description": null, + "created_at": "2021-02-18T08:22:48Z", + "updated_at": "2021-02-18T09:47:16Z", + "statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728/statuses", + "repository_url": "https://api.github.com/repos/Codertocat/Hello-World" + } }, "repository": { "id": 186853002, diff --git a/payload-schemas/schemas/check_run/completed.schema.json b/payload-schemas/schemas/check_run/completed.schema.json index e8b41d6d1..f3073544f 100644 --- a/payload-schemas/schemas/check_run/completed.schema.json +++ b/payload-schemas/schemas/check_run/completed.schema.json @@ -195,7 +195,8 @@ }, "additionalProperties": false } - } + }, + "deployment": { "$ref": "common/check-run-deployment.schema.json" } }, "additionalProperties": false }, diff --git a/payload-schemas/schemas/check_run/created.schema.json b/payload-schemas/schemas/check_run/created.schema.json index 6c07caebd..63578f74c 100644 --- a/payload-schemas/schemas/check_run/created.schema.json +++ b/payload-schemas/schemas/check_run/created.schema.json @@ -180,7 +180,8 @@ }, "additionalProperties": false } - } + }, + "deployment": { "$ref": "common/check-run-deployment.schema.json" } }, "additionalProperties": false }, diff --git a/payload-schemas/schemas/check_run/requested_action.schema.json b/payload-schemas/schemas/check_run/requested_action.schema.json index be195eb7a..932c06e94 100644 --- a/payload-schemas/schemas/check_run/requested_action.schema.json +++ b/payload-schemas/schemas/check_run/requested_action.schema.json @@ -195,7 +195,8 @@ }, "additionalProperties": false } - } + }, + "deployment": { "$ref": "common/check-run-deployment.schema.json" } }, "additionalProperties": false }, diff --git a/payload-schemas/schemas/check_run/rerequested.schema.json b/payload-schemas/schemas/check_run/rerequested.schema.json index 3e0daaf09..9ec48a6ff 100644 --- a/payload-schemas/schemas/check_run/rerequested.schema.json +++ b/payload-schemas/schemas/check_run/rerequested.schema.json @@ -191,7 +191,8 @@ }, "additionalProperties": false } - } + }, + "deployment": { "$ref": "common/check-run-deployment.schema.json" } }, "additionalProperties": false }, diff --git a/payload-schemas/schemas/common/check-run-deployment.schema.json b/payload-schemas/schemas/common/check-run-deployment.schema.json new file mode 100644 index 000000000..7ad521802 --- /dev/null +++ b/payload-schemas/schemas/common/check-run-deployment.schema.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "common/check-run-deployment.schema.json", + "type": "object", + "required": [ + "url", + "id", + "node_id", + "task", + "original_environment", + "environment", + "description", + "created_at", + "updated_at", + "statuses_url", + "repository_url" + ], + "properties": { + "url": { "type": "string", "format": "uri" }, + "id": { "type": "integer" }, + "node_id": { "type": "string" }, + "task": { "type": "string" }, + "original_environment": { "type": "string" }, + "environment": { "type": "string" }, + "description": { "type": ["string", "null"] }, + "created_at": { "type": "string", "format": "date-time" }, + "updated_at": { "type": "string", "format": "date-time" }, + "statuses_url": { "type": "string", "format": "uri" }, + "repository_url": { "type": "string", "format": "uri" } + }, + "additionalProperties": false, + "description": "A deployment to a repository environment. This will only be populated if the check run was created by a GitHub Actions workflow job that references an environment.", + "title": "Check Run Deployment" +} diff --git a/schema.d.ts b/schema.d.ts index a275eef3b..da7bcab56 100644 --- a/schema.d.ts +++ b/schema.d.ts @@ -351,6 +351,7 @@ export interface CheckRunCompletedEvent { repo: RepoRef; }; }[]; + deployment?: CheckRunDeployment; }; requested_action?: { identifier?: string; @@ -443,6 +444,22 @@ export interface User { type: "Bot" | "User" | "Organization"; site_admin: boolean; } +/** + * A deployment to a repository environment. This will only be populated if the check run was created by a GitHub Actions workflow job that references an environment. + */ +export interface CheckRunDeployment { + url: string; + id: number; + node_id: string; + task: string; + original_environment: string; + environment: string; + description: string | null; + created_at: string; + updated_at: string; + statuses_url: string; + repository_url: string; +} /** * A git repository */ @@ -709,6 +726,7 @@ export interface CheckRunCreatedEvent { repo: RepoRef; }; }[]; + deployment?: CheckRunDeployment; }; requested_action?: { identifier?: string; @@ -825,6 +843,7 @@ export interface CheckRunRequestedActionEvent { repo: RepoRef; }; }[]; + deployment?: CheckRunDeployment; }; requested_action?: { identifier?: string; @@ -940,6 +959,7 @@ export interface CheckRunRerequestedEvent { repo: RepoRef; }; }[]; + deployment?: CheckRunDeployment; }; requested_action?: { identifier?: string;