Skip to content

Commit

Permalink
feat: schema updates to workflow_job, organization.renamed events…
Browse files Browse the repository at this point in the history
… and common schemas (#753)

* feat: new `followers` permission for GitHub apps

* fix: add `merge_queues` permission to `Installation` schema

* feat: new `workflow_name` property on `WorkflowJob` schema

* feat: new `has_discussions` property on `Repository` schema

* build: generate types

* fix: update `workflow_job` payloads

* fix: update schema for `organization.renamed` event

* feat: new example for `organization.renamed` event

* build: generate `index.json`

* build: generate types
  • Loading branch information
wolfy1339 committed Dec 29, 2022
1 parent 237b692 commit e69d6ec
Show file tree
Hide file tree
Showing 12 changed files with 143 additions and 13 deletions.
54 changes: 50 additions & 4 deletions payload-examples/api.github.com/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -31760,6 +31760,48 @@
"id": 1,
"node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMQ=="
}
},
{
"action": "renamed",
"changes": { "login": { "from": "Octocoders" } },
"organization": {
"login": "Octocoders",
"id": 38302899,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjM4MzAyODk5",
"url": "https://api.github.com/orgs/Octocoders",
"repos_url": "https://api.github.com/orgs/Octocoders/repos",
"events_url": "https://api.github.com/orgs/Octocoders/events",
"hooks_url": "https://api.github.com/orgs/Octocoders/hooks",
"issues_url": "https://api.github.com/orgs/Octocoders/issues",
"members_url": "https://api.github.com/orgs/Octocoders/members{/member}",
"public_members_url": "https://api.github.com/orgs/Octocoders/public_members{/member}",
"avatar_url": "https://avatars1.githubusercontent.com/u/38302899?v=4",
"description": ""
},
"sender": {
"login": "Codertocat",
"id": 21031067,
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Codertocat",
"html_url": "https://github.com/Codertocat",
"followers_url": "https://api.github.com/users/Codertocat/followers",
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
"repos_url": "https://api.github.com/users/Codertocat/repos",
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
"type": "User",
"site_admin": false
},
"installation": {
"id": 1,
"node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMQ=="
}
}
]
},
Expand Down Expand Up @@ -69817,7 +69859,8 @@
"runner_id": 5,
"runner_name": "GitHub Actions 5",
"runner_group_id": 2,
"runner_group_name": "GitHub Actions"
"runner_group_name": "GitHub Actions",
"workflow_name": "CodeQL"
},
"repository": {
"id": 186853002,
Expand Down Expand Up @@ -70039,7 +70082,8 @@
"runner_id": 5,
"runner_name": "GitHub Actions 5",
"runner_group_id": 2,
"runner_group_name": "GitHub Actions"
"runner_group_name": "GitHub Actions",
"workflow_name": "CodeQL"
},
"repository": {
"id": 186853002,
Expand Down Expand Up @@ -70205,7 +70249,8 @@
"runner_id": 5,
"runner_name": "GitHub Actions 5",
"runner_group_id": 2,
"runner_group_name": "GitHub Actions"
"runner_group_name": "GitHub Actions",
"workflow_name": "CodeQL"
},
"repository": {
"id": 186853002,
Expand Down Expand Up @@ -70352,7 +70397,8 @@
"runner_id": 5,
"runner_name": "GitHub Actions 5",
"runner_group_id": 2,
"runner_group_name": "GitHub Actions"
"runner_group_name": "GitHub Actions",
"workflow_name": "CodeQL"
},
"repository": {
"id": 186853002,
Expand Down
46 changes: 46 additions & 0 deletions payload-examples/api.github.com/organization/renamed.payload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"action": "renamed",
"changes": {
"login": {
"from": "Octocoders"
}
},
"organization": {
"login": "Octocoders",
"id": 38302899,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjM4MzAyODk5",
"url": "https://api.github.com/orgs/Octocoders",
"repos_url": "https://api.github.com/orgs/Octocoders/repos",
"events_url": "https://api.github.com/orgs/Octocoders/events",
"hooks_url": "https://api.github.com/orgs/Octocoders/hooks",
"issues_url": "https://api.github.com/orgs/Octocoders/issues",
"members_url": "https://api.github.com/orgs/Octocoders/members{/member}",
"public_members_url": "https://api.github.com/orgs/Octocoders/public_members{/member}",
"avatar_url": "https://avatars1.githubusercontent.com/u/38302899?v=4",
"description": ""
},
"sender": {
"login": "Codertocat",
"id": 21031067,
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Codertocat",
"html_url": "https://github.com/Codertocat",
"followers_url": "https://api.github.com/users/Codertocat/followers",
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
"repos_url": "https://api.github.com/users/Codertocat/repos",
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
"type": "User",
"site_admin": false
},
"installation": {
"id": 1,
"node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMQ=="
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
"runner_id": 5,
"runner_name": "GitHub Actions 5",
"runner_group_id": 2,
"runner_group_name": "GitHub Actions"
"runner_group_name": "GitHub Actions",
"workflow_name": "CodeQL"
},
"repository": {
"id": 186853002,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
"runner_id": 5,
"runner_name": "GitHub Actions 5",
"runner_group_id": 2,
"runner_group_name": "GitHub Actions"
"runner_group_name": "GitHub Actions",
"workflow_name": "CodeQL"
},
"repository": {
"id": 186853002,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"runner_id": 5,
"runner_name": "GitHub Actions 5",
"runner_group_id": 2,
"runner_group_name": "GitHub Actions"
"runner_group_name": "GitHub Actions",
"workflow_name": "CodeQL"
},
"repository": {
"id": 186853002,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"runner_id": 5,
"runner_name": "GitHub Actions 5",
"runner_group_id": 2,
"runner_group_name": "GitHub Actions"
"runner_group_name": "GitHub Actions",
"workflow_name": "CodeQL"
},
"repository": {
"id": 186853002,
Expand Down
1 change: 1 addition & 0 deletions payload-schemas/api.github.com/common/app.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"discussions": { "type": "string", "enum": ["read", "write"] },
"emails": { "type": "string", "enum": ["read", "write"] },
"environments": { "type": "string", "enum": ["read", "write"] },
"followers": { "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
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"enum": ["read", "write"],
"description": "The level of permission granted to the access token for organization teams and members."
},
"merge_queues": { "type": "string", "enum": ["read", "write"] },
"metadata": {
"type": "string",
"enum": ["read", "write"],
Expand Down
5 changes: 5 additions & 0 deletions payload-schemas/api.github.com/common/repository.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@
"default": true
},
"has_pages": { "type": "boolean" },
"has_discussions": {
"type": "boolean",
"description": "Whether discussions are enabled.",
"default": true
},
"forks_count": { "type": "integer" },
"mirror_url": { "type": ["string", "null"], "format": "uri" },
"archived": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"runner_id",
"runner_name",
"runner_group_id",
"runner_group_name"
"runner_group_name",
"workflow_name"
],
"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 @@ -73,7 +74,8 @@
"started_at": { "type": "string", "format": "date-time" },
"completed_at": {
"oneOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }]
}
},
"workflow_name": { "type": "string" }
},
"additionalProperties": false,
"title": "Workflow Job"
Expand Down
18 changes: 16 additions & 2 deletions payload-schemas/api.github.com/organization/renamed.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "organization$renamed",
"type": "object",
"required": ["action", "membership", "organization", "sender"],
"required": ["changes", "action", "organization", "sender"],
"properties": {
"changes": {
"type": "object",
"required": ["login"],
"properties": {
"login": {
"type": "object",
"required": ["from"],
"properties": {
"from": { "type": "string" }
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"action": { "type": "string", "enum": ["renamed"] },
"membership": { "$ref": "common/membership.schema.json" },
"sender": { "$ref": "common/user.schema.json" },
"installation": { "$ref": "common/installation-lite.schema.json" },
"organization": { "$ref": "common/organization.schema.json" }
Expand Down
13 changes: 12 additions & 1 deletion payload-types/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,10 @@ export interface Repository {
*/
has_wiki: boolean;
has_pages: boolean;
/**
* Whether discussions are enabled.
*/
has_discussions?: boolean;
forks_count: number;
mirror_url: string | null;
/**
Expand Down Expand Up @@ -1051,6 +1055,7 @@ export interface App {
discussions?: "read" | "write";
emails?: "read" | "write";
environments?: "read" | "write";
followers?: "read" | "write";
issues?: "read" | "write";
keys?: "read" | "write";
members?: "read" | "write";
Expand Down Expand Up @@ -3266,6 +3271,7 @@ export interface Installation {
* The level of permission granted to the access token for organization teams and members.
*/
members?: "read" | "write";
merge_queues?: "read" | "write";
/**
* The level of permission granted to the access token to search repositories, list collaborators, and access repository metadata.
*/
Expand Down Expand Up @@ -4559,8 +4565,12 @@ export interface OrganizationMemberRemovedEvent {
organization: Organization;
}
export interface OrganizationRenamedEvent {
changes: {
login: {
from: string;
};
};
action: "renamed";
membership: Membership;
sender: User;
installation?: InstallationLite;
organization: Organization;
Expand Down Expand Up @@ -7536,6 +7546,7 @@ export interface WorkflowJob {
runner_group_name: string | null;
started_at: string;
completed_at: string | null;
workflow_name: string;
}
export interface WorkflowStepInProgress {
name: string;
Expand Down

0 comments on commit e69d6ec

Please sign in to comment.