Skip to content

Commit 9c2d5f6

Browse files
authored
fix: refactor workflow_job.queued event to use the WorkflowJob common shema (#657)
1 parent 812a536 commit 9c2d5f6

File tree

3 files changed

+14
-75
lines changed

3 files changed

+14
-75
lines changed

payload-schemas/api.github.com/common/workflow-job.schema.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
},
4444
"steps": {
4545
"type": "array",
46-
"items": { "$ref": "workflow-step.schema.json" },
47-
"minItems": 1
46+
"items": { "$ref": "workflow-step.schema.json" }
4847
},
4948
"conclusion": {
5049
"type": ["string", "null"],

payload-schemas/api.github.com/workflow_job/queued.schema.json

+11-49
Original file line numberDiff line numberDiff line change
@@ -10,55 +10,17 @@
1010
"repository": { "$ref": "common/repository.schema.json" },
1111
"sender": { "$ref": "common/user.schema.json" },
1212
"workflow_job": {
13-
"type": "object",
14-
"required": [
15-
"id",
16-
"run_id",
17-
"run_url",
18-
"run_attempt",
19-
"node_id",
20-
"head_sha",
21-
"url",
22-
"html_url",
23-
"status",
24-
"conclusion",
25-
"started_at",
26-
"completed_at",
27-
"name",
28-
"steps",
29-
"check_run_url",
30-
"labels",
31-
"runner_id",
32-
"runner_name",
33-
"runner_group_id",
34-
"runner_group_name"
35-
],
36-
"properties": {
37-
"id": { "type": "integer" },
38-
"run_id": { "type": "number" },
39-
"run_url": { "type": "string", "format": "uri" },
40-
"run_attempt": { "type": "integer" },
41-
"head_sha": { "type": "string" },
42-
"node_id": { "type": "string" },
43-
"name": { "type": "string" },
44-
"check_run_url": { "type": "string", "format": "uri" },
45-
"html_url": { "type": "string", "format": "uri" },
46-
"url": { "type": "string", "format": "uri" },
47-
"status": { "type": "string", "enum": ["queued"] },
48-
"steps": {
49-
"type": "array",
50-
"items": { "$ref": "common/workflow-step.schema.json" }
51-
},
52-
"conclusion": { "type": "null" },
53-
"labels": { "type": "array", "items": { "type": "string" } },
54-
"runner_id": { "type": ["integer", "null"] },
55-
"runner_name": { "type": ["string", "null"] },
56-
"runner_group_id": { "type": ["integer", "null"] },
57-
"runner_group_name": { "type": ["string", "null"] },
58-
"started_at": { "type": "string", "format": "date-time" },
59-
"completed_at": { "type": "null" }
60-
},
61-
"additionalProperties": false
13+
"allOf": [
14+
{ "$ref": "common/workflow-job.schema.json" },
15+
{
16+
"type": "object",
17+
"required": ["status"],
18+
"properties": {
19+
"status": { "type": "string", "enum": ["queued"] }
20+
},
21+
"tsAdditionalProperties": false
22+
}
23+
]
6224
}
6325
},
6426
"additionalProperties": false,

payload-types/schema.d.ts

+2-24
Original file line numberDiff line numberDiff line change
@@ -6256,10 +6256,7 @@ export interface WorkflowJob {
62566256
* The current status of the job. Can be `queued`, `in_progress`, or `completed`.
62576257
*/
62586258
status: "queued" | "in_progress" | "completed";
6259-
/**
6260-
* @minItems 1
6261-
*/
6262-
steps: [WorkflowStep, ...WorkflowStep[]];
6259+
steps: WorkflowStep[];
62636260
conclusion: "success" | "failure" | "cancelled" | "skipped" | null;
62646261
/**
62656262
* Custom labels for the job. Specified by the [`"runs-on"` attribute](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on) in the workflow YAML.
@@ -6316,27 +6313,8 @@ export interface WorkflowJobQueuedEvent {
63166313
installation?: InstallationLite;
63176314
repository: Repository;
63186315
sender: User;
6319-
workflow_job: {
6320-
id: number;
6321-
run_id: number;
6322-
run_url: string;
6323-
run_attempt: number;
6324-
head_sha: string;
6325-
node_id: string;
6326-
name: string;
6327-
check_run_url: string;
6328-
html_url: string;
6329-
url: string;
6316+
workflow_job: WorkflowJob & {
63306317
status: "queued";
6331-
steps: WorkflowStep[];
6332-
conclusion: null;
6333-
labels: string[];
6334-
runner_id: number | null;
6335-
runner_name: string | null;
6336-
runner_group_id: number | null;
6337-
runner_group_name: string | null;
6338-
started_at: string;
6339-
completed_at: null;
63406318
};
63416319
}
63426320
export interface WorkflowRunCompletedEvent {

0 commit comments

Comments
 (0)