Skip to content

Commit

Permalink
fix: refactor workflow_job.queued event to use the WorkflowJob co…
Browse files Browse the repository at this point in the history
…mmon shema (#657)
  • Loading branch information
Helcaraxan committed Jul 5, 2022
1 parent 812a536 commit 9c2d5f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 75 deletions.
Expand Up @@ -43,8 +43,7 @@
},
"steps": {
"type": "array",
"items": { "$ref": "workflow-step.schema.json" },
"minItems": 1
"items": { "$ref": "workflow-step.schema.json" }
},
"conclusion": {
"type": ["string", "null"],
Expand Down
60 changes: 11 additions & 49 deletions payload-schemas/api.github.com/workflow_job/queued.schema.json
Expand Up @@ -10,55 +10,17 @@
"repository": { "$ref": "common/repository.schema.json" },
"sender": { "$ref": "common/user.schema.json" },
"workflow_job": {
"type": "object",
"required": [
"id",
"run_id",
"run_url",
"run_attempt",
"node_id",
"head_sha",
"url",
"html_url",
"status",
"conclusion",
"started_at",
"completed_at",
"name",
"steps",
"check_run_url",
"labels",
"runner_id",
"runner_name",
"runner_group_id",
"runner_group_name"
],
"properties": {
"id": { "type": "integer" },
"run_id": { "type": "number" },
"run_url": { "type": "string", "format": "uri" },
"run_attempt": { "type": "integer" },
"head_sha": { "type": "string" },
"node_id": { "type": "string" },
"name": { "type": "string" },
"check_run_url": { "type": "string", "format": "uri" },
"html_url": { "type": "string", "format": "uri" },
"url": { "type": "string", "format": "uri" },
"status": { "type": "string", "enum": ["queued"] },
"steps": {
"type": "array",
"items": { "$ref": "common/workflow-step.schema.json" }
},
"conclusion": { "type": "null" },
"labels": { "type": "array", "items": { "type": "string" } },
"runner_id": { "type": ["integer", "null"] },
"runner_name": { "type": ["string", "null"] },
"runner_group_id": { "type": ["integer", "null"] },
"runner_group_name": { "type": ["string", "null"] },
"started_at": { "type": "string", "format": "date-time" },
"completed_at": { "type": "null" }
},
"additionalProperties": false
"allOf": [
{ "$ref": "common/workflow-job.schema.json" },
{
"type": "object",
"required": ["status"],
"properties": {
"status": { "type": "string", "enum": ["queued"] }
},
"tsAdditionalProperties": false
}
]
}
},
"additionalProperties": false,
Expand Down
26 changes: 2 additions & 24 deletions payload-types/schema.d.ts
Expand Up @@ -6256,10 +6256,7 @@ export interface WorkflowJob {
* The current status of the job. Can be `queued`, `in_progress`, or `completed`.
*/
status: "queued" | "in_progress" | "completed";
/**
* @minItems 1
*/
steps: [WorkflowStep, ...WorkflowStep[]];
steps: WorkflowStep[];
conclusion: "success" | "failure" | "cancelled" | "skipped" | null;
/**
* 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.
Expand Down Expand Up @@ -6316,27 +6313,8 @@ export interface WorkflowJobQueuedEvent {
installation?: InstallationLite;
repository: Repository;
sender: User;
workflow_job: {
id: number;
run_id: number;
run_url: string;
run_attempt: number;
head_sha: string;
node_id: string;
name: string;
check_run_url: string;
html_url: string;
url: string;
workflow_job: WorkflowJob & {
status: "queued";
steps: WorkflowStep[];
conclusion: null;
labels: string[];
runner_id: number | null;
runner_name: string | null;
runner_group_id: number | null;
runner_group_name: string | null;
started_at: string;
completed_at: null;
};
}
export interface WorkflowRunCompletedEvent {
Expand Down

0 comments on commit 9c2d5f6

Please sign in to comment.