diff --git a/.github/actions/lib/action-context.js b/.github/actions/lib/action-context.js index 137abec732c3..5eadd2f2000c 100644 --- a/.github/actions/lib/action-context.js +++ b/.github/actions/lib/action-context.js @@ -2,6 +2,9 @@ import { readFileSync } from 'fs' // Parses the action event payload sets repo and owner to an object from runner environment export function getActionContext() { + if (!process.env.GITHUB_EVENT_PATH) { + throw new Error('process.env.GITHUB_EVENT_PATH is not set') + } const context = JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8')) if (context.repository) { context.owner = context.repository.owner.login diff --git a/lib/rest/static/decorated/api.github.com.json b/lib/rest/static/decorated/api.github.com.json index 890c082f170c..978c66c06c37 100644 --- a/lib/rest/static/decorated/api.github.com.json +++ b/lib/rest/static/decorated/api.github.com.json @@ -362130,10 +362130,28 @@ ] }, { - "type": "", + "type": "object", "name": "source", "in": "body", - "description": "" + "description": "

Update the source for the repository. Must include the branch name and path.

", + "childParamsGroups": [ + { + "type": "string", + "name": "branch", + "description": "

The repository branch used to publish your site's source files.

", + "isRequired": true + }, + { + "type": "string", + "name": "path", + "description": "

The repository directory that includes the source files for the Pages site. Allowed paths are / or /docs.

", + "isRequired": true, + "enum": [ + "/", + "/docs" + ] + } + ] } ], "enabledForGitHubApps": true, diff --git a/lib/rest/static/decorated/ghec.json b/lib/rest/static/decorated/ghec.json index 18045695569a..92ce8de2f37b 100644 --- a/lib/rest/static/decorated/ghec.json +++ b/lib/rest/static/decorated/ghec.json @@ -364090,10 +364090,28 @@ ] }, { - "type": "", + "type": "object", "name": "source", "in": "body", - "description": "" + "description": "

Update the source for the repository. Must include the branch name and path.

", + "childParamsGroups": [ + { + "type": "string", + "name": "branch", + "description": "

The repository branch used to publish your site's source files.

", + "isRequired": true + }, + { + "type": "string", + "name": "path", + "description": "

The repository directory that includes the source files for the Pages site. Allowed paths are / or /docs.

", + "isRequired": true, + "enum": [ + "/", + "/docs" + ] + } + ] } ], "enabledForGitHubApps": true, diff --git a/lib/rest/static/decorated/ghes-3.3.json b/lib/rest/static/decorated/ghes-3.3.json index b1cbc6386551..8e3eea61f44e 100644 --- a/lib/rest/static/decorated/ghes-3.3.json +++ b/lib/rest/static/decorated/ghes-3.3.json @@ -284466,10 +284466,28 @@ ] }, { - "type": "", + "type": "object", "name": "source", "in": "body", - "description": "" + "description": "

Update the source for the repository. Must include the branch name and path.

", + "childParamsGroups": [ + { + "type": "string", + "name": "branch", + "description": "

The repository branch used to publish your site's source files.

", + "isRequired": true + }, + { + "type": "string", + "name": "path", + "description": "

The repository directory that includes the source files for the Pages site. Allowed paths are / or /docs.

", + "isRequired": true, + "enum": [ + "/", + "/docs" + ] + } + ] } ], "enabledForGitHubApps": true, diff --git a/lib/rest/static/decorated/ghes-3.4.json b/lib/rest/static/decorated/ghes-3.4.json index 712559043e1f..326cb90f95b4 100644 --- a/lib/rest/static/decorated/ghes-3.4.json +++ b/lib/rest/static/decorated/ghes-3.4.json @@ -302677,10 +302677,28 @@ ] }, { - "type": "", + "type": "object", "name": "source", "in": "body", - "description": "" + "description": "

Update the source for the repository. Must include the branch name and path.

", + "childParamsGroups": [ + { + "type": "string", + "name": "branch", + "description": "

The repository branch used to publish your site's source files.

", + "isRequired": true + }, + { + "type": "string", + "name": "path", + "description": "

The repository directory that includes the source files for the Pages site. Allowed paths are / or /docs.

", + "isRequired": true, + "enum": [ + "/", + "/docs" + ] + } + ] } ], "enabledForGitHubApps": true, diff --git a/lib/rest/static/decorated/ghes-3.5.json b/lib/rest/static/decorated/ghes-3.5.json index 4321e849140a..c08ab28f931c 100644 --- a/lib/rest/static/decorated/ghes-3.5.json +++ b/lib/rest/static/decorated/ghes-3.5.json @@ -309839,10 +309839,28 @@ ] }, { - "type": "", + "type": "object", "name": "source", "in": "body", - "description": "" + "description": "

Update the source for the repository. Must include the branch name and path.

", + "childParamsGroups": [ + { + "type": "string", + "name": "branch", + "description": "

The repository branch used to publish your site's source files.

", + "isRequired": true + }, + { + "type": "string", + "name": "path", + "description": "

The repository directory that includes the source files for the Pages site. Allowed paths are / or /docs.

", + "isRequired": true, + "enum": [ + "/", + "/docs" + ] + } + ] } ], "enabledForGitHubApps": true, diff --git a/lib/rest/static/decorated/ghes-3.6.json b/lib/rest/static/decorated/ghes-3.6.json index c4ba25c849df..669faec2bcde 100644 --- a/lib/rest/static/decorated/ghes-3.6.json +++ b/lib/rest/static/decorated/ghes-3.6.json @@ -319190,10 +319190,28 @@ ] }, { - "type": "", + "type": "object", "name": "source", "in": "body", - "description": "" + "description": "

Update the source for the repository. Must include the branch name and path.

", + "childParamsGroups": [ + { + "type": "string", + "name": "branch", + "description": "

The repository branch used to publish your site's source files.

", + "isRequired": true + }, + { + "type": "string", + "name": "path", + "description": "

The repository directory that includes the source files for the Pages site. Allowed paths are / or /docs.

", + "isRequired": true, + "enum": [ + "/", + "/docs" + ] + } + ] } ], "enabledForGitHubApps": true, diff --git a/lib/rest/static/decorated/ghes-3.7.json b/lib/rest/static/decorated/ghes-3.7.json index f340b7e9940e..85a638f55919 100644 --- a/lib/rest/static/decorated/ghes-3.7.json +++ b/lib/rest/static/decorated/ghes-3.7.json @@ -322640,10 +322640,28 @@ ] }, { - "type": "", + "type": "object", "name": "source", "in": "body", - "description": "" + "description": "

Update the source for the repository. Must include the branch name and path.

", + "childParamsGroups": [ + { + "type": "string", + "name": "branch", + "description": "

The repository branch used to publish your site's source files.

", + "isRequired": true + }, + { + "type": "string", + "name": "path", + "description": "

The repository directory that includes the source files for the Pages site. Allowed paths are / or /docs.

", + "isRequired": true, + "enum": [ + "/", + "/docs" + ] + } + ] } ], "enabledForGitHubApps": true, diff --git a/lib/rest/static/decorated/github.ae.json b/lib/rest/static/decorated/github.ae.json index bf6de8f81325..957670958c74 100644 --- a/lib/rest/static/decorated/github.ae.json +++ b/lib/rest/static/decorated/github.ae.json @@ -261820,10 +261820,28 @@ ] }, { - "type": "", + "type": "object", "name": "source", "in": "body", - "description": "" + "description": "

Update the source for the repository. Must include the branch name and path.

", + "childParamsGroups": [ + { + "type": "string", + "name": "branch", + "description": "

The repository branch used to publish your site's source files.

", + "isRequired": true + }, + { + "type": "string", + "name": "path", + "description": "

The repository directory that includes the source files for the Pages site. Allowed paths are / or /docs.

", + "isRequired": true, + "enum": [ + "/", + "/docs" + ] + } + ] } ], "enabledForGitHubApps": true, diff --git a/package-lock.json b/package-lock.json index 9d231e732955..897fc694e4c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3481,6 +3481,201 @@ "resolved": "https://registry.npmjs.org/@next/env/-/env-12.2.4.tgz", "integrity": "sha512-/gApFXWk5CCLFQJL5IYJXxPQuG5tz5nPX4l27A9Zm/+wJxiwFrRSP54AopDxIv4JRp/rGwcgk/lZS/0Clw8jYA==" }, + "node_modules/@next/swc-android-arm-eabi": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.2.4.tgz", + "integrity": "sha512-P4YSFNpmXXSnn3P1qsOAqz+MX3On9fHrlc8ovb/CFJJoU+YLCR53iCEwfw39e0IZEgDA7ttgr108plF8mxaX0g==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-android-arm64": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.2.4.tgz", + "integrity": "sha512-4o2n14E18O+8xHlf6dgJsWPXN9gmSmfIe2Z0EqKDIPBBkFt/2CyrH0+vwHnL2l7xkDHhOGfZYcYIWVUR5aNu0A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.2.4.tgz", + "integrity": "sha512-DcUO6MGBL9E3jj5o86MUnTOy4WawIJJhyCcFYO4f51sbl7+uPIYIx40eo98A6NwJEXazCqq1hLeqOaNTAIvDiQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.2.4.tgz", + "integrity": "sha512-IUlFMqeLjdIzDorrGC2Dt+2Ae3DbKQbRzCzmDq4/CP1+jJGeDXo/2AHnlE+WYnwQAC4KtAz6pbVnd3KstZWsVA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-freebsd-x64": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.2.4.tgz", + "integrity": "sha512-475vwyWcjnyDVDWLgAATP0HI8W1rwByc+uXk1B6KkAVFhkoDgH387LW0uNqxavK+VxCzj3avQXX/58XDvxtSlg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm-gnueabihf": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.2.4.tgz", + "integrity": "sha512-qZW+L3iG3XSGtlOPmD5RRWXyk6ZNdscLV0BQjuDvP+exTg+uixqHXOHz0/GVATIJEBQOF0Kew7jAXVXEP+iRTQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.2.4.tgz", + "integrity": "sha512-fEPRjItWYaKyyG9N+2HIA59OBHIhk7WC+Rh+LwXsh0pQe870Ykpek3KQs0umjsrEGe57NyMomq3f80/N8taDvA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.2.4.tgz", + "integrity": "sha512-rnCTzXII0EBCcFn9P5s/Dho2kPUMSX/bP0iOAj8wEI/IxUEfEElbin89zJoNW30cycHu19xY8YP4K2+hzciPzQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.2.4.tgz", + "integrity": "sha512-PhXX6NSuIuhHInxPY2VkG2Bl7VllsD3Cjx+pQcS1wTym7Zt7UoLvn05PkRrkiyIkvR+UXnqPUM3TYiSbnemXEw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.2.4.tgz", + "integrity": "sha512-GmC/QROiUZpFirHRfPQqMyCXZ+5+ndbBZrMvL74HtQB/CKXB8K1VM+rvy9Gp/5OaU8Rxp48IcX79NOfI2LiXlA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.2.4.tgz", + "integrity": "sha512-9XKoCXbNZuaMRPtcKQz3+hgVpkMosaLlcxHFXT8/j4w61k7/qvEbrkMDS9WHNrD/xVcLycwhPRgXcns2K1BdBQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.2.4.tgz", + "integrity": "sha512-hEyRieZKH9iw4AzvXaQ+Fyb98k0G/o9QcRGxA1/O/O/elf1+Qvuwb15phT8GbVtIeNziy66XTPOhKKfdr8KyUg==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.2.4.tgz", + "integrity": "sha512-5Pl1tdMJWLy4rvzU1ecx0nHWgDPqoYuvYoXE/5X0Clu9si/yOuBIj573F2kOTY7mu0LX2wgCJVSnyK0abHBxIw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -22956,6 +23151,84 @@ "resolved": "https://registry.npmjs.org/@next/env/-/env-12.2.4.tgz", "integrity": "sha512-/gApFXWk5CCLFQJL5IYJXxPQuG5tz5nPX4l27A9Zm/+wJxiwFrRSP54AopDxIv4JRp/rGwcgk/lZS/0Clw8jYA==" }, + "@next/swc-android-arm-eabi": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.2.4.tgz", + "integrity": "sha512-P4YSFNpmXXSnn3P1qsOAqz+MX3On9fHrlc8ovb/CFJJoU+YLCR53iCEwfw39e0IZEgDA7ttgr108plF8mxaX0g==", + "optional": true + }, + "@next/swc-android-arm64": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.2.4.tgz", + "integrity": "sha512-4o2n14E18O+8xHlf6dgJsWPXN9gmSmfIe2Z0EqKDIPBBkFt/2CyrH0+vwHnL2l7xkDHhOGfZYcYIWVUR5aNu0A==", + "optional": true + }, + "@next/swc-darwin-arm64": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.2.4.tgz", + "integrity": "sha512-DcUO6MGBL9E3jj5o86MUnTOy4WawIJJhyCcFYO4f51sbl7+uPIYIx40eo98A6NwJEXazCqq1hLeqOaNTAIvDiQ==", + "optional": true + }, + "@next/swc-darwin-x64": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.2.4.tgz", + "integrity": "sha512-IUlFMqeLjdIzDorrGC2Dt+2Ae3DbKQbRzCzmDq4/CP1+jJGeDXo/2AHnlE+WYnwQAC4KtAz6pbVnd3KstZWsVA==", + "optional": true + }, + "@next/swc-freebsd-x64": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.2.4.tgz", + "integrity": "sha512-475vwyWcjnyDVDWLgAATP0HI8W1rwByc+uXk1B6KkAVFhkoDgH387LW0uNqxavK+VxCzj3avQXX/58XDvxtSlg==", + "optional": true + }, + "@next/swc-linux-arm-gnueabihf": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.2.4.tgz", + "integrity": "sha512-qZW+L3iG3XSGtlOPmD5RRWXyk6ZNdscLV0BQjuDvP+exTg+uixqHXOHz0/GVATIJEBQOF0Kew7jAXVXEP+iRTQ==", + "optional": true + }, + "@next/swc-linux-arm64-gnu": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.2.4.tgz", + "integrity": "sha512-fEPRjItWYaKyyG9N+2HIA59OBHIhk7WC+Rh+LwXsh0pQe870Ykpek3KQs0umjsrEGe57NyMomq3f80/N8taDvA==", + "optional": true + }, + "@next/swc-linux-arm64-musl": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.2.4.tgz", + "integrity": "sha512-rnCTzXII0EBCcFn9P5s/Dho2kPUMSX/bP0iOAj8wEI/IxUEfEElbin89zJoNW30cycHu19xY8YP4K2+hzciPzQ==", + "optional": true + }, + "@next/swc-linux-x64-gnu": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.2.4.tgz", + "integrity": "sha512-PhXX6NSuIuhHInxPY2VkG2Bl7VllsD3Cjx+pQcS1wTym7Zt7UoLvn05PkRrkiyIkvR+UXnqPUM3TYiSbnemXEw==", + "optional": true + }, + "@next/swc-linux-x64-musl": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.2.4.tgz", + "integrity": "sha512-GmC/QROiUZpFirHRfPQqMyCXZ+5+ndbBZrMvL74HtQB/CKXB8K1VM+rvy9Gp/5OaU8Rxp48IcX79NOfI2LiXlA==", + "optional": true + }, + "@next/swc-win32-arm64-msvc": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.2.4.tgz", + "integrity": "sha512-9XKoCXbNZuaMRPtcKQz3+hgVpkMosaLlcxHFXT8/j4w61k7/qvEbrkMDS9WHNrD/xVcLycwhPRgXcns2K1BdBQ==", + "optional": true + }, + "@next/swc-win32-ia32-msvc": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.2.4.tgz", + "integrity": "sha512-hEyRieZKH9iw4AzvXaQ+Fyb98k0G/o9QcRGxA1/O/O/elf1+Qvuwb15phT8GbVtIeNziy66XTPOhKKfdr8KyUg==", + "optional": true + }, + "@next/swc-win32-x64-msvc": { + "version": "12.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.2.4.tgz", + "integrity": "sha512-5Pl1tdMJWLy4rvzU1ecx0nHWgDPqoYuvYoXE/5X0Clu9si/yOuBIj573F2kOTY7mu0LX2wgCJVSnyK0abHBxIw==", + "optional": true + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", diff --git a/script/rest/utils/get-body-params.js b/script/rest/utils/get-body-params.js index 922e13618a94..1abaee7569a4 100644 --- a/script/rest/utils/get-body-params.js +++ b/script/rest/utils/get-body-params.js @@ -47,7 +47,6 @@ export async function getBodyParams(schema, topLevel = false) { for (const [paramKey, param] of Object.entries(properties)) { const paramDecorated = {} - // OpenAPI 3.0 only had a single value for `type`. OpenAPI 3.1 // will either be a single value or an array of values. // This makes type an array regardless of how many values the array @@ -120,6 +119,26 @@ export async function getBodyParams(schema, topLevel = false) { // is in the first child parameter. const oneOfDescriptions = descriptions.length ? descriptions[0].description : '' if (!param.description) param.description = oneOfDescriptions + + // This is a workaround for an operation that incorrectly defines allOf for a + // body parameter. As a workaround, we will use the first object in the list of + // the allOf array. Otherwise, fallback to the first item in the array. + // This isn't ideal, and in the case of an actual allOf occurrence, we should + // handle it differently by merging all of the properties. There is currently + // only one occurrence for the operation id repos/update-information-about-pages-site + // See Ecosystem API issue number #3332 for future plans to fix this in the OpenAPI + } else if (param && param.anyOf && Object.keys(param).length === 1) { + const firstObject = Object.values(param.anyOf).find((item) => item.type === 'object') + if (firstObject) { + paramType.push('object') + param.description = firstObject.description + param.isRequired = firstObject.required + childParamsGroups.push(...(await getBodyParams(firstObject, false))) + } else { + paramType.push(param.anyOf[0].type) + param.description = param.anyOf[0].description + param.isRequired = param.anyOf[0].required + } } // Supports backwards compatibility for OpenAPI 3.0