Skip to content

Commit

Permalink
feat: updates to deployment and deployment_status events, new `de…
Browse files Browse the repository at this point in the history
…ployment` property for `check_run` event (#601)

* feat: new `deployment` property on `check_run` event
* feat: extract `deployment` into common schema
* feat: `deployment.created#workflow` can also be a `workflow` common schema
* fix: `environment_url` can be an empty string
* feat: new `check_run` property on `deployment_status#created` event
* feat: new `workflow_run` property on `deployment_status` event
* fix: `workflow_run` property can also be a `workflow_run` object on the `deployment#created` event
* build: generate types
  • Loading branch information
wolfy1339 committed Jan 3, 2022
1 parent 7ff9d85 commit be7f17c
Show file tree
Hide file tree
Showing 9 changed files with 299 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@
"pull_requests": {
"type": "array",
"items": { "$ref": "common/check-run-pull-request.schema.json" }
}
},
"deployment": { "$ref": "common/check-run-deployment.schema.json" }
},
"additionalProperties": false
},
Expand Down
3 changes: 2 additions & 1 deletion payload-schemas/api.github.com/check_run/created.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@
"pull_requests": {
"type": "array",
"items": { "$ref": "common/check-run-pull-request.schema.json" }
}
},
"deployment": { "$ref": "common/check-run-deployment.schema.json" }
},
"additionalProperties": false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@
"pull_requests": {
"type": "array",
"items": { "$ref": "common/check-run-pull-request.schema.json" }
}
},
"deployment": { "$ref": "common/check-run-deployment.schema.json" }
},
"additionalProperties": false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@
"pull_requests": {
"type": "array",
"items": { "$ref": "common/check-run-pull-request.schema.json" }
}
},
"deployment": { "$ref": "common/check-run-deployment.schema.json" }
},
"additionalProperties": false
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "common/deployment-workflow-run.schema.json",
"type": "object",
"required": [
"id",
"name",
"node_id",
"head_branch",
"head_sha",
"run_number",
"event",
"status",
"conclusion",
"workflow_id",
"check_suite_id",
"check_suite_node_id",
"url",
"html_url",
"pull_requests",
"created_at",
"updated_at",
"run_attempt",
"run_started_at"
],
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"node_id": { "type": "string" },
"head_branch": { "type": "string" },
"head_sha": { "type": "string" },
"run_number": { "type": "integer" },
"event": { "type": "string" },
"status": {
"type": "string",
"enum": ["requested", "in_progress", "completed", "queued"]
},
"conclusion": {
"type": ["string", "null"],
"enum": [
"success",
"failure",
"neutral",
"cancelled",
"timed_out",
"action_required",
"stale",
null
]
},
"workflow_id": { "type": "integer" },
"check_suite_id": { "type": "integer" },
"check_suite_node_id": { "type": "string" },
"url": { "type": "string", "format": "uri" },
"html_url": { "type": "string", "format": "uri" },
"pull_requests": {
"type": "array",
"items": { "$ref": "check-run-pull-request.schema.json" }
},
"created_at": { "type": "string", "format": "date-time" },
"updated_at": { "type": "string", "format": "date-time" },
"run_attempt": { "type": "integer" },
"run_started_at": { "type": "string", "format": "date-time" }
},
"additionalProperties": false,
"title": "Deployment Workflow Run"
}
51 changes: 51 additions & 0 deletions payload-schemas/api.github.com/common/deployment.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "common/deployment.schema.json",
"required": [
"url",
"id",
"node_id",
"sha",
"ref",
"task",
"payload",
"original_environment",
"environment",
"description",
"creator",
"created_at",
"updated_at",
"statuses_url",
"repository_url"
],
"type": "object",
"properties": {
"url": { "type": "string", "format": "uri" },
"id": { "type": "integer" },
"node_id": { "type": "string" },
"sha": { "type": "string" },
"ref": { "type": "string" },
"task": { "type": "string" },
"payload": {
"type": "object",
"required": [],
"additionalProperties": true
},
"original_environment": { "type": "string" },
"environment": { "type": "string" },
"transient_environment": { "type": "boolean" },
"production_environment": { "type": "boolean" },
"description": { "type": ["string", "null"] },
"creator": { "$ref": "user.schema.json" },
"created_at": { "type": "string" },
"updated_at": { "type": "string" },
"statuses_url": { "type": "string", "format": "uri" },
"repository_url": { "type": "string", "format": "uri" },
"performed_via_github_app": {
"oneOf": [{ "$ref": "app.schema.json" }, { "type": "null" }]
}
},
"additionalProperties": false,
"description": "The [deployment](https://docs.github.com/en/rest/reference/deployments#list-deployments).",
"title": "Deployment"
}
58 changes: 9 additions & 49 deletions payload-schemas/api.github.com/deployment/created.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,16 @@
],
"properties": {
"action": { "type": "string", "enum": ["created"] },
"deployment": {
"type": "object",
"description": "The [deployment](https://docs.github.com/en/rest/reference/deployments#list-deployments).",
"required": [
"url",
"id",
"node_id",
"sha",
"ref",
"task",
"payload",
"original_environment",
"environment",
"description",
"creator",
"created_at",
"updated_at",
"statuses_url",
"repository_url"
],
"properties": {
"url": { "type": "string", "format": "uri" },
"id": { "type": "integer" },
"node_id": { "type": "string" },
"sha": { "type": "string" },
"ref": { "type": "string" },
"task": { "type": "string" },
"payload": {
"type": "object",
"required": [],
"additionalProperties": true
},
"original_environment": { "type": "string" },
"environment": { "type": "string" },
"transient_environment": { "type": "boolean" },
"production_environment": { "type": "boolean" },
"description": { "type": "null" },
"creator": { "$ref": "common/user.schema.json" },
"created_at": { "type": "string" },
"updated_at": { "type": "string" },
"statuses_url": { "type": "string", "format": "uri" },
"repository_url": { "type": "string", "format": "uri" },
"performed_via_github_app": {
"oneOf": [{ "$ref": "common/app.schema.json" }, { "type": "null" }]
}
},
"additionalProperties": false
"deployment": { "$ref": "common/deployment.schema.json" },
"workflow": {
"oneOf": [{ "$ref": "common/workflow.schema.json" }, { "type": "null" }]
},
"workflow_run": {
"oneOf": [
{ "$ref": "common/deployment-workflow-run.schema.json" },
{ "type": "null" }
]
},
"workflow": { "type": "null" },
"workflow_run": { "type": "null" },
"repository": { "$ref": "common/repository.schema.json" },
"sender": { "$ref": "common/user.schema.json" },
"installation": { "$ref": "common/installation-lite.schema.json" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@
"description": "The optional human-readable description added to the status."
},
"environment": { "type": "string" },
"environment_url": { "type": "string", "format": "uri" },
"environment_url": {
"oneOf": [
{ "type": "string", "format": "uri" },
{ "type": "string", "enum": [""] }
]
},
"log_url": { "type": "string", "format": "uri" },
"target_url": {
"type": "string",
Expand All @@ -58,53 +63,64 @@
},
"additionalProperties": false
},
"deployment": {
"deployment": { "$ref": "common/deployment.schema.json" },
"check_run": {
"type": "object",
"description": "The [deployment](https://docs.github.com/en/rest/reference/repos#list-deployments) that this status is associated with.",
"required": [
"url",
"id",
"name",
"node_id",
"sha",
"ref",
"task",
"payload",
"original_environment",
"environment",
"description",
"creator",
"created_at",
"updated_at",
"statuses_url",
"repository_url",
"performed_via_github_app"
"head_sha",
"external_id",
"url",
"html_url",
"details_url",
"status",
"conclusion",
"started_at",
"completed_at"
],
"properties": {
"url": { "type": "string", "format": "uri" },
"id": { "type": "integer" },
"id": { "type": "integer", "description": "The id of the check." },
"name": {
"type": "string",
"description": "The name of the check run."
},
"node_id": { "type": "string" },
"sha": { "type": "string" },
"ref": { "type": "string" },
"task": { "type": "string" },
"payload": {
"type": "object",
"required": [],
"additionalProperties": false
"head_sha": {
"type": "string",
"description": "The SHA of the commit that is being checked."
},
"original_environment": { "type": "string" },
"environment": { "type": "string" },
"description": { "type": "null" },
"creator": { "$ref": "common/user.schema.json" },
"created_at": { "type": "string" },
"updated_at": { "type": "string" },
"statuses_url": { "type": "string", "format": "uri" },
"repository_url": { "type": "string", "format": "uri" },
"performed_via_github_app": {
"oneOf": [{ "$ref": "common/app.schema.json" }, { "type": "null" }]
}
"external_id": { "type": "string" },
"url": { "type": "string", "format": "uri" },
"html_url": { "type": "string", "format": "uri" },
"details_url": { "type": "string", "format": "uri" },
"status": {
"type": "string",
"enum": ["queued", "in_progress", "completed"],
"description": "The current status of the check run. Can be `queued`, `in_progress`, or `completed`."
},
"conclusion": {
"type": ["string", "null"],
"enum": [
"success",
"failure",
"neutral",
"cancelled",
"timed_out",
"action_required",
"stale",
"skipped",
null
],
"description": "The result of the completed check run. Can be one of `success`, `failure`, `neutral`, `cancelled`, `timed_out`, `action_required` or `stale`. This value will be `null` until the check run has completed."
},
"started_at": { "type": "string", "format": "date-time" },
"completed_at": { "type": ["string", "null"], "format": "date-time" }
},
"additionalProperties": false
},
"workflow_run": { "$ref": "common/deployment-workflow-run.schema.json" },
"repository": { "$ref": "common/repository.schema.json" },
"sender": { "$ref": "common/user.schema.json" },
"installation": { "$ref": "common/installation-lite.schema.json" },
Expand Down

0 comments on commit be7f17c

Please sign in to comment.