Skip to content

Commit

Permalink
feat: updates to webhook event schemas (#785)
Browse files Browse the repository at this point in the history
* feat: new `pull_request.{demilestoned, milestroned}` events

* feat: many new app permissions

* feat: new `pull_request_review_thread` app event

* feat: new properties for `workflow_job` events

* feat: new `subject_type` property for `PullRequestReviewComment` events

* build: generate types

* build: update example payloads

* style: run lint script

* fix: `pull_request.head.repo` can be `null`
  • Loading branch information
wolfy1339 committed Apr 7, 2023
1 parent 4ef898a commit 84ce9b0
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 5 deletions.
8 changes: 8 additions & 0 deletions payload-examples/api.github.com/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -69749,12 +69749,14 @@
"run_attempt": 1,
"node_id": "MDExOldvcmtmbG93UnVuMjg5NzgyNDUx",
"head_sha": "3484a3fb816e0859fd6e1cea078d76385ff50625",
"head_branch": "main",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/1291536064",
"html_url": "https://github.com/octo-org/octo-repo/runs/1291536064",
"status": "completed",
"conclusion": "failure",
"started_at": "2021-08-05T10:34:58Z",
"completed_at": "2021-08-05T10:38:16Z",
"created_at": "2021-08-05T10:33:58Z",
"name": "linters",
"steps": [
{
Expand Down Expand Up @@ -70004,11 +70006,13 @@
"run_attempt": 1,
"node_id": "MDExOldvcmtmbG93UnVuMjg5NzgyNDUx",
"head_sha": "3484a3fb816e0859fd6e1cea078d76385ff50625",
"head_branch": "main",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/1291536064",
"html_url": "https://github.com/octo-org/octo-repo/runs/1291536064",
"status": "completed",
"conclusion": "success",
"started_at": "2021-08-05T10:34:58Z",
"created_at": "2021-08-05T10:33:58Z",
"completed_at": "2021-08-05T10:38:16Z",
"name": "linters",
"steps": [
Expand Down Expand Up @@ -70227,11 +70231,13 @@
"run_attempt": 1,
"node_id": "MDExOldvcmtmbG93UnVuMjg5NzgyNDUx",
"head_sha": "3484a3fb816e0859fd6e1cea078d76385ff50625",
"head_branch": "main",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/1291536064",
"html_url": "https://github.com/octo-org/octo-repo/runs/1291536064",
"status": "in_progress",
"conclusion": null,
"started_at": "2021-09-13T02:21:13Z",
"created_at": "2021-09-13T02:21:13Z",
"completed_at": null,
"name": "Analyze (javascript)",
"steps": [
Expand Down Expand Up @@ -70384,11 +70390,13 @@
"run_attempt": 1,
"node_id": "MDExOldvcmtmbG93UnVuMjg5NzgyNDUx",
"head_sha": "3484a3fb816e0859fd6e1cea078d76385ff50625",
"head_branch": "main",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/1291536064",
"html_url": "https://github.com/octo-org/octo-repo/runs/1291536064",
"status": "queued",
"conclusion": null,
"started_at": "2021-09-13T02:21:13Z",
"created_at": "2021-09-13T02:21:13Z",
"completed_at": null,
"name": "update",
"steps": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"run_attempt": 1,
"node_id": "MDExOldvcmtmbG93UnVuMjg5NzgyNDUx",
"head_sha": "3484a3fb816e0859fd6e1cea078d76385ff50625",
"head_branch": "main",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/1291536064",
"html_url": "https://github.com/octo-org/octo-repo/runs/1291536064",
"status": "completed",
"conclusion": "failure",
"started_at": "2021-08-05T10:34:58Z",
"completed_at": "2021-08-05T10:38:16Z",
"created_at": "2021-08-05T10:33:58Z",
"name": "linters",
"steps": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
"run_attempt": 1,
"node_id": "MDExOldvcmtmbG93UnVuMjg5NzgyNDUx",
"head_sha": "3484a3fb816e0859fd6e1cea078d76385ff50625",
"head_branch": "main",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/1291536064",
"html_url": "https://github.com/octo-org/octo-repo/runs/1291536064",
"status": "completed",
"conclusion": "success",
"started_at": "2021-08-05T10:34:58Z",
"created_at": "2021-08-05T10:33:58Z",
"completed_at": "2021-08-05T10:38:16Z",
"name": "linters",
"steps": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
"run_attempt": 1,
"node_id": "MDExOldvcmtmbG93UnVuMjg5NzgyNDUx",
"head_sha": "3484a3fb816e0859fd6e1cea078d76385ff50625",
"head_branch": "main",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/1291536064",
"html_url": "https://github.com/octo-org/octo-repo/runs/1291536064",
"status": "in_progress",
"conclusion": null,
"started_at": "2021-09-13T02:21:13Z",
"created_at": "2021-09-13T02:21:13Z",
"completed_at": null,
"name": "Analyze (javascript)",
"steps": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
"run_attempt": 1,
"node_id": "MDExOldvcmtmbG93UnVuMjg5NzgyNDUx",
"head_sha": "3484a3fb816e0859fd6e1cea078d76385ff50625",
"head_branch": "main",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/1291536064",
"html_url": "https://github.com/octo-org/octo-repo/runs/1291536064",
"status": "queued",
"conclusion": null,
"started_at": "2021-09-13T02:21:13Z",
"created_at": "2021-09-13T02:21:13Z",
"completed_at": null,
"name": "update",
"steps": [],
Expand Down
6 changes: 6 additions & 0 deletions payload-schemas/api.github.com/common/app.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"emails": { "type": "string", "enum": ["read", "write"] },
"environments": { "type": "string", "enum": ["read", "write"] },
"followers": { "type": "string", "enum": ["read", "write"] },
"gpg_keys": { "type": "string", "enum": ["read", "write"] },
"interaction_limits": { "type": "string", "enum": ["read", "write"] },
"issues": { "type": "string", "enum": ["read", "write"] },
"keys": { "type": "string", "enum": ["read", "write"] },
"members": { "type": "string", "enum": ["read", "write"] },
Expand Down Expand Up @@ -76,6 +78,7 @@
},
"packages": { "type": "string", "enum": ["read", "write"] },
"pages": { "type": "string", "enum": ["read", "write"] },
"plan": { "type": "string", "enum": ["read", "write"] },
"pull_requests": { "type": "string", "enum": ["read", "write"] },
"repository_hooks": { "type": "string", "enum": ["read", "write"] },
"repository_projects": { "type": "string", "enum": ["read", "write"] },
Expand All @@ -90,9 +93,11 @@
"enum": ["read", "write"]
},
"single_file": { "type": "string", "enum": ["read", "write"] },
"starring": { "type": "string", "enum": ["read", "write"] },
"statuses": { "type": "string", "enum": ["read", "write"] },
"team_discussions": { "type": "string", "enum": ["read", "write"] },
"vulnerability_alerts": { "type": "string", "enum": ["read", "write"] },
"watching": { "type": "string", "enum": ["read", "write"] },
"workflows": { "type": "string", "enum": ["read", "write"] }
},
"additionalProperties": false
Expand Down Expand Up @@ -138,6 +143,7 @@
"pull_request",
"pull_request_review",
"pull_request_review_comment",
"pull_request_review_thread",
"push",
"registry_package",
"release",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@
"in_reply_to_id": {
"type": "integer",
"description": "The comment ID to reply to."
},
"subject_type": {
"description": "The level at which the comment is targeted, can be a diff line or a file.",
"type": "string",
"enum": ["line", "file"]
}
},
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@
"ref": { "type": "string" },
"sha": { "type": "string" },
"user": { "$ref": "user.schema.json" },
"repo": { "$ref": "repository.schema.json" }
"repo": {
"oneOf": [{ "$ref": "repository.schema.json" }, { "type": "null" }]
}
},
"additionalProperties": false
},
Expand Down
14 changes: 12 additions & 2 deletions payload-schemas/api.github.com/common/workflow-job.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"conclusion",
"started_at",
"completed_at",
"created_at",
"name",
"steps",
"check_run_url",
Expand All @@ -22,7 +23,8 @@
"runner_name",
"runner_group_id",
"runner_group_name",
"workflow_name"
"workflow_name",
"head_branch"
],
"description": "The workflow job. Many `workflow_job` keys, such as `head_sha`, `conclusion`, and `started_at` are the same as those in a [`check_run`](#check_run) object.",
"type": "object",
Expand Down Expand Up @@ -75,7 +77,15 @@
"completed_at": {
"oneOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }]
},
"workflow_name": { "type": "string" }
"workflow_name": {
"type": ["string", "null"],
"description": "The name of the workflow."
},
"head_branch": {
"type": ["string", "null"],
"description": "The name of the current branch."
},
"created_at": { "type": "string", "format": "date-time" }
},
"additionalProperties": false,
"title": "Workflow Job"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "pull_request$demilestoned",
"type": "object",
"required": [
"action",
"number",
"pull_request",
"milestone",
"repository",
"sender"
],
"properties": {
"action": { "type": "string", "enum": ["demilestoned"] },
"number": { "type": "integer", "description": "The pull request number." },
"pull_request": {
"allOf": [
{ "$ref": "common/pull-request.schema.json" },
{
"type": "object",
"required": ["milestone"],
"properties": {
"milestone": { "$ref": "common/milestone.schema.json" }
},
"tsAdditionalProperties": false
}
]
},
"milestone": { "$ref": "common/milestone.schema.json" },
"repository": { "$ref": "common/repository.schema.json" },
"sender": { "$ref": "common/user.schema.json" },
"installation": { "$ref": "common/installation-lite.schema.json" },
"organization": { "$ref": "common/organization.schema.json" }
},
"additionalProperties": false,
"title": "pull_request demilestoned event"
}
37 changes: 37 additions & 0 deletions payload-schemas/api.github.com/pull_request/milestoned.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "pull_request$milestoned",
"type": "object",
"required": [
"action",
"number",
"pull_request",
"milestone",
"repository",
"sender"
],
"properties": {
"action": { "type": "string", "enum": ["milestoned"] },
"number": { "type": "integer", "description": "The pull request number." },
"pull_request": {
"allOf": [
{ "$ref": "common/pull-request.schema.json" },
{
"type": "object",
"required": ["milestone"],
"properties": {
"milestone": { "$ref": "common/milestone.schema.json" }
},
"tsAdditionalProperties": false
}
]
},
"milestone": { "$ref": "common/milestone.schema.json" },
"repository": { "$ref": "common/repository.schema.json" },
"sender": { "$ref": "common/user.schema.json" },
"installation": { "$ref": "common/installation-lite.schema.json" },
"organization": { "$ref": "common/organization.schema.json" }
},
"additionalProperties": false,
"title": "pull_request milestoned event"
}

0 comments on commit 84ce9b0

Please sign in to comment.