Skip to content

Commit b2b91c5

Browse files
authored
feat(typescript): new deployment object for CheckRunEvent #381
1 parent 86d79ec commit b2b91c5

File tree

9 files changed

+131
-8
lines changed

9 files changed

+131
-8
lines changed

cache/webhook-events-and-payloads.html

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,15 @@ <h4 id="webhook-payload-object">
571571
empty.
572572
</td>
573573
</tr>
574+
<tr>
575+
<td><code>deployment</code></td>
576+
<td><code>object</code></td>
577+
<td>
578+
A deployment to a repository environment. This will only be populated
579+
if the check run was created by a GitHub Actions workflow job that
580+
references an environment.
581+
</td>
582+
</tr>
574583
<tr>
575584
<td><code>requested_action</code></td>
576585
<td><code>object</code></td>
@@ -812,7 +821,20 @@ <h4 id="webhook-payload-example">
812821
}
813822
}
814823
}
815-
]
824+
],
825+
<span class="hljs-attr">"deployment"</span>: {
826+
<span class="hljs-attr">"url"</span>: <span class="hljs-string">"https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728"</span>,
827+
<span class="hljs-attr">"id"</span>: <span class="hljs-number">326191728</span>,
828+
<span class="hljs-attr">"node_id"</span>: <span class="hljs-string">"MDEwOkRlcGxveW1lbnQzMjYxOTE3Mjg="</span>,
829+
<span class="hljs-attr">"task"</span>: <span class="hljs-string">"deploy"</span>,
830+
<span class="hljs-attr">"original_environment"</span>: <span class="hljs-string">"lab"</span>,
831+
<span class="hljs-attr">"environment"</span>: <span class="hljs-string">"lab"</span>,
832+
<span class="hljs-attr">"description"</span>: <span class="hljs-literal">null</span>,
833+
<span class="hljs-attr">"created_at"</span>: <span class="hljs-string">"2021-02-18T08:22:48Z"</span>,
834+
<span class="hljs-attr">"updated_at"</span>: <span class="hljs-string">"2021-02-18T09:47:16Z"</span>,
835+
<span class="hljs-attr">"statuses_url"</span>: <span class="hljs-string">"https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728/statuses"</span>,
836+
<span class="hljs-attr">"repository_url"</span>: <span class="hljs-string">"https://api.github.com/repos/Codertocat/Hello-World"</span>
837+
}
816838
},
817839
<span class="hljs-attr">"repository"</span>: {
818840
<span class="hljs-attr">"id"</span>: <span class="hljs-number">186853002</span>,

index.json

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
"type": "array",
2929
"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."
3030
},
31+
"deployment": {
32+
"type": "object",
33+
"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."
34+
},
3135
"requested_action": {
3236
"type": "object",
3337
"description": "The action requested by the user."
@@ -242,7 +246,20 @@
242246
}
243247
}
244248
}
245-
]
249+
],
250+
"deployment": {
251+
"url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728",
252+
"id": 326191728,
253+
"node_id": "MDEwOkRlcGxveW1lbnQzMjYxOTE3Mjg=",
254+
"task": "deploy",
255+
"original_environment": "lab",
256+
"environment": "lab",
257+
"description": null,
258+
"created_at": "2021-02-18T08:22:48Z",
259+
"updated_at": "2021-02-18T09:47:16Z",
260+
"statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728/statuses",
261+
"repository_url": "https://api.github.com/repos/Codertocat/Hello-World"
262+
}
246263
},
247264
"repository": {
248265
"id": 186853002,
@@ -1471,7 +1488,20 @@
14711488
}
14721489
}
14731490
}
1474-
]
1491+
],
1492+
"deployment": {
1493+
"url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728",
1494+
"id": 326191728,
1495+
"node_id": "MDEwOkRlcGxveW1lbnQzMjYxOTE3Mjg=",
1496+
"task": "deploy",
1497+
"original_environment": "lab",
1498+
"environment": "lab",
1499+
"description": null,
1500+
"created_at": "2021-02-18T08:22:48Z",
1501+
"updated_at": "2021-02-18T09:47:16Z",
1502+
"statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728/statuses",
1503+
"repository_url": "https://api.github.com/repos/Codertocat/Hello-World"
1504+
}
14751505
},
14761506
"repository": {
14771507
"id": 186853002,

payload-examples/api.github.com/check_run/created.payload.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,20 @@
186186
}
187187
}
188188
}
189-
]
189+
],
190+
"deployment": {
191+
"url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728",
192+
"id": 326191728,
193+
"node_id": "MDEwOkRlcGxveW1lbnQzMjYxOTE3Mjg=",
194+
"task": "deploy",
195+
"original_environment": "lab",
196+
"environment": "lab",
197+
"description": null,
198+
"created_at": "2021-02-18T08:22:48Z",
199+
"updated_at": "2021-02-18T09:47:16Z",
200+
"statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments/326191728/statuses",
201+
"repository_url": "https://api.github.com/repos/Codertocat/Hello-World"
202+
}
190203
},
191204
"repository": {
192205
"id": 186853002,

payload-schemas/schemas/check_run/completed.schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@
195195
},
196196
"additionalProperties": false
197197
}
198-
}
198+
},
199+
"deployment": { "$ref": "common/check-run-deployment.schema.json" }
199200
},
200201
"additionalProperties": false
201202
},

payload-schemas/schemas/check_run/created.schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@
180180
},
181181
"additionalProperties": false
182182
}
183-
}
183+
},
184+
"deployment": { "$ref": "common/check-run-deployment.schema.json" }
184185
},
185186
"additionalProperties": false
186187
},

payload-schemas/schemas/check_run/requested_action.schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@
195195
},
196196
"additionalProperties": false
197197
}
198-
}
198+
},
199+
"deployment": { "$ref": "common/check-run-deployment.schema.json" }
199200
},
200201
"additionalProperties": false
201202
},

payload-schemas/schemas/check_run/rerequested.schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@
191191
},
192192
"additionalProperties": false
193193
}
194-
}
194+
},
195+
"deployment": { "$ref": "common/check-run-deployment.schema.json" }
195196
},
196197
"additionalProperties": false
197198
},
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema",
3+
"$id": "common/check-run-deployment.schema.json",
4+
"type": "object",
5+
"required": [
6+
"url",
7+
"id",
8+
"node_id",
9+
"task",
10+
"original_environment",
11+
"environment",
12+
"description",
13+
"created_at",
14+
"updated_at",
15+
"statuses_url",
16+
"repository_url"
17+
],
18+
"properties": {
19+
"url": { "type": "string", "format": "uri" },
20+
"id": { "type": "integer" },
21+
"node_id": { "type": "string" },
22+
"task": { "type": "string" },
23+
"original_environment": { "type": "string" },
24+
"environment": { "type": "string" },
25+
"description": { "type": ["string", "null"] },
26+
"created_at": { "type": "string", "format": "date-time" },
27+
"updated_at": { "type": "string", "format": "date-time" },
28+
"statuses_url": { "type": "string", "format": "uri" },
29+
"repository_url": { "type": "string", "format": "uri" }
30+
},
31+
"additionalProperties": false,
32+
"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.",
33+
"title": "Check Run Deployment"
34+
}

schema.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ export interface CheckRunCompletedEvent {
351351
repo: RepoRef;
352352
};
353353
}[];
354+
deployment?: CheckRunDeployment;
354355
};
355356
requested_action?: {
356357
identifier?: string;
@@ -443,6 +444,22 @@ export interface User {
443444
type: "Bot" | "User" | "Organization";
444445
site_admin: boolean;
445446
}
447+
/**
448+
* 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.
449+
*/
450+
export interface CheckRunDeployment {
451+
url: string;
452+
id: number;
453+
node_id: string;
454+
task: string;
455+
original_environment: string;
456+
environment: string;
457+
description: string | null;
458+
created_at: string;
459+
updated_at: string;
460+
statuses_url: string;
461+
repository_url: string;
462+
}
446463
/**
447464
* A git repository
448465
*/
@@ -709,6 +726,7 @@ export interface CheckRunCreatedEvent {
709726
repo: RepoRef;
710727
};
711728
}[];
729+
deployment?: CheckRunDeployment;
712730
};
713731
requested_action?: {
714732
identifier?: string;
@@ -825,6 +843,7 @@ export interface CheckRunRequestedActionEvent {
825843
repo: RepoRef;
826844
};
827845
}[];
846+
deployment?: CheckRunDeployment;
828847
};
829848
requested_action?: {
830849
identifier?: string;
@@ -940,6 +959,7 @@ export interface CheckRunRerequestedEvent {
940959
repo: RepoRef;
941960
};
942961
}[];
962+
deployment?: CheckRunDeployment;
943963
};
944964
requested_action?: {
945965
identifier?: string;

0 commit comments

Comments
 (0)