From e69d6eca4e5f1505afacd0677c4303877caca0d6 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Thu, 29 Dec 2022 16:52:15 -0500 Subject: [PATCH] feat: schema updates to `workflow_job`, `organization.renamed` events 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 --- payload-examples/api.github.com/index.json | 54 +++++++++++++++++-- .../organization/renamed.payload.json | 46 ++++++++++++++++ ...ted.failure.with-organization.payload.json | 3 +- ...ted.success.with-organization.payload.json | 3 +- .../workflow_job/in_progress.payload.json | 3 +- .../workflow_job/queued.payload.json | 3 +- .../api.github.com/common/app.schema.json | 1 + .../common/installation.schema.json | 1 + .../common/repository.schema.json | 5 ++ .../common/workflow-job.schema.json | 6 ++- .../organization/renamed.schema.json | 18 ++++++- payload-types/schema.d.ts | 13 ++++- 12 files changed, 143 insertions(+), 13 deletions(-) create mode 100644 payload-examples/api.github.com/organization/renamed.payload.json diff --git a/payload-examples/api.github.com/index.json b/payload-examples/api.github.com/index.json index f83b1fc97..56588ee65 100644 --- a/payload-examples/api.github.com/index.json +++ b/payload-examples/api.github.com/index.json @@ -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==" + } } ] }, @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/payload-examples/api.github.com/organization/renamed.payload.json b/payload-examples/api.github.com/organization/renamed.payload.json new file mode 100644 index 000000000..1df5fa9c0 --- /dev/null +++ b/payload-examples/api.github.com/organization/renamed.payload.json @@ -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==" + } +} diff --git a/payload-examples/api.github.com/workflow_job/completed.failure.with-organization.payload.json b/payload-examples/api.github.com/workflow_job/completed.failure.with-organization.payload.json index b20a88536..712b6b3dd 100644 --- a/payload-examples/api.github.com/workflow_job/completed.failure.with-organization.payload.json +++ b/payload-examples/api.github.com/workflow_job/completed.failure.with-organization.payload.json @@ -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, diff --git a/payload-examples/api.github.com/workflow_job/completed.success.with-organization.payload.json b/payload-examples/api.github.com/workflow_job/completed.success.with-organization.payload.json index 5f24db2e9..74ab99eeb 100644 --- a/payload-examples/api.github.com/workflow_job/completed.success.with-organization.payload.json +++ b/payload-examples/api.github.com/workflow_job/completed.success.with-organization.payload.json @@ -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, diff --git a/payload-examples/api.github.com/workflow_job/in_progress.payload.json b/payload-examples/api.github.com/workflow_job/in_progress.payload.json index db4af0a7c..b78a416f7 100644 --- a/payload-examples/api.github.com/workflow_job/in_progress.payload.json +++ b/payload-examples/api.github.com/workflow_job/in_progress.payload.json @@ -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, diff --git a/payload-examples/api.github.com/workflow_job/queued.payload.json b/payload-examples/api.github.com/workflow_job/queued.payload.json index 2c60a0fe8..7245aac78 100644 --- a/payload-examples/api.github.com/workflow_job/queued.payload.json +++ b/payload-examples/api.github.com/workflow_job/queued.payload.json @@ -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, diff --git a/payload-schemas/api.github.com/common/app.schema.json b/payload-schemas/api.github.com/common/app.schema.json index 990baf3ae..ee2723667 100644 --- a/payload-schemas/api.github.com/common/app.schema.json +++ b/payload-schemas/api.github.com/common/app.schema.json @@ -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"] }, diff --git a/payload-schemas/api.github.com/common/installation.schema.json b/payload-schemas/api.github.com/common/installation.schema.json index 78182102a..645103f21 100644 --- a/payload-schemas/api.github.com/common/installation.schema.json +++ b/payload-schemas/api.github.com/common/installation.schema.json @@ -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"], diff --git a/payload-schemas/api.github.com/common/repository.schema.json b/payload-schemas/api.github.com/common/repository.schema.json index e462ac4e6..0ee8a8d07 100644 --- a/payload-schemas/api.github.com/common/repository.schema.json +++ b/payload-schemas/api.github.com/common/repository.schema.json @@ -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": { diff --git a/payload-schemas/api.github.com/common/workflow-job.schema.json b/payload-schemas/api.github.com/common/workflow-job.schema.json index b294e3f17..c1dd1cb29 100644 --- a/payload-schemas/api.github.com/common/workflow-job.schema.json +++ b/payload-schemas/api.github.com/common/workflow-job.schema.json @@ -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", @@ -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" diff --git a/payload-schemas/api.github.com/organization/renamed.schema.json b/payload-schemas/api.github.com/organization/renamed.schema.json index 0c438d07c..91f759c1e 100644 --- a/payload-schemas/api.github.com/organization/renamed.schema.json +++ b/payload-schemas/api.github.com/organization/renamed.schema.json @@ -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" } diff --git a/payload-types/schema.d.ts b/payload-types/schema.d.ts index 5d47dc684..658fed605 100644 --- a/payload-types/schema.d.ts +++ b/payload-types/schema.d.ts @@ -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; /** @@ -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"; @@ -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. */ @@ -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; @@ -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;