diff --git a/src/audit-logs/data/fpt/organization.json b/src/audit-logs/data/fpt/organization.json index 10547e24abb7..f6291411b2e5 100644 --- a/src/audit-logs/data/fpt/organization.json +++ b/src/audit-logs/data/fpt/organization.json @@ -397,6 +397,27 @@ "action" ] }, + { + "action": "billing.overage_policy_updated", + "description": "The premium request paid usage policy for your GitHub account was changed.", + "docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage", + "fields": [ + "actor", + "actor_id", + "user_agent", + "request_id", + "request_access_security_header", + "business", + "business_id", + "action", + "_document_id", + "@timestamp", + "created_at", + "operation_type", + "actor_is_bot" + ], + "docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage" + }, { "action": "billing.unlock", "description": "N/A", @@ -1387,7 +1408,7 @@ "operation_type", "actor_is_bot" ], - "docs_reference_titles": "GitHub Copilot billing" + "docs_reference_titles": "GitHub Copilot licenses" }, { "action": "copilot.plan_downgrade_scheduled", diff --git a/src/audit-logs/data/fpt/user.json b/src/audit-logs/data/fpt/user.json index 9ff44dfb6d21..6eb2833c6b8a 100644 --- a/src/audit-logs/data/fpt/user.json +++ b/src/audit-logs/data/fpt/user.json @@ -320,6 +320,27 @@ "action" ] }, + { + "action": "billing.overage_policy_updated", + "description": "The premium request paid usage policy for your GitHub account was changed.", + "docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage", + "fields": [ + "actor", + "actor_id", + "user_agent", + "request_id", + "request_access_security_header", + "business", + "business_id", + "action", + "_document_id", + "@timestamp", + "created_at", + "operation_type", + "actor_is_bot" + ], + "docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage" + }, { "action": "billing.unlock", "description": "N/A", diff --git a/src/audit-logs/data/ghec/enterprise.json b/src/audit-logs/data/ghec/enterprise.json index bc356ed6b90e..2413bf0a10dc 100644 --- a/src/audit-logs/data/ghec/enterprise.json +++ b/src/audit-logs/data/ghec/enterprise.json @@ -529,6 +529,27 @@ "action" ] }, + { + "action": "billing.overage_policy_updated", + "description": "The premium request paid usage policy for your GitHub account was changed.", + "docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage", + "fields": [ + "actor", + "actor_id", + "user_agent", + "request_id", + "request_access_security_header", + "business", + "business_id", + "action", + "_document_id", + "@timestamp", + "created_at", + "operation_type", + "actor_is_bot" + ], + "docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage" + }, { "action": "billing.unlock", "description": "N/A", @@ -4319,7 +4340,7 @@ "operation_type", "actor_is_bot" ], - "docs_reference_titles": "GitHub Copilot billing" + "docs_reference_titles": "GitHub Copilot licenses" }, { "action": "copilot.plan_downgrade_scheduled", diff --git a/src/audit-logs/data/ghec/organization.json b/src/audit-logs/data/ghec/organization.json index 10547e24abb7..f6291411b2e5 100644 --- a/src/audit-logs/data/ghec/organization.json +++ b/src/audit-logs/data/ghec/organization.json @@ -397,6 +397,27 @@ "action" ] }, + { + "action": "billing.overage_policy_updated", + "description": "The premium request paid usage policy for your GitHub account was changed.", + "docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage", + "fields": [ + "actor", + "actor_id", + "user_agent", + "request_id", + "request_access_security_header", + "business", + "business_id", + "action", + "_document_id", + "@timestamp", + "created_at", + "operation_type", + "actor_is_bot" + ], + "docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage" + }, { "action": "billing.unlock", "description": "N/A", @@ -1387,7 +1408,7 @@ "operation_type", "actor_is_bot" ], - "docs_reference_titles": "GitHub Copilot billing" + "docs_reference_titles": "GitHub Copilot licenses" }, { "action": "copilot.plan_downgrade_scheduled", diff --git a/src/audit-logs/data/ghec/user.json b/src/audit-logs/data/ghec/user.json index 9ff44dfb6d21..6eb2833c6b8a 100644 --- a/src/audit-logs/data/ghec/user.json +++ b/src/audit-logs/data/ghec/user.json @@ -320,6 +320,27 @@ "action" ] }, + { + "action": "billing.overage_policy_updated", + "description": "The premium request paid usage policy for your GitHub account was changed.", + "docs_reference_links": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage", + "fields": [ + "actor", + "actor_id", + "user_agent", + "request_id", + "request_access_security_header", + "business", + "business_id", + "action", + "_document_id", + "@timestamp", + "created_at", + "operation_type", + "actor_is_bot" + ], + "docs_reference_titles": "/copilot/how-tos/manage-and-track-spending/manage-request-allowances#setting-a-policy-for-paid-usage" + }, { "action": "billing.unlock", "description": "N/A", diff --git a/src/audit-logs/data/ghes-3.14/organization.json b/src/audit-logs/data/ghes-3.14/organization.json index d43ba5859d5d..533e49141e25 100644 --- a/src/audit-logs/data/ghes-3.14/organization.json +++ b/src/audit-logs/data/ghes-3.14/organization.json @@ -1057,7 +1057,7 @@ "operation_type", "actor_is_bot" ], - "docs_reference_titles": "GitHub Copilot billing" + "docs_reference_titles": "GitHub Copilot licenses" }, { "action": "custom_hosted_runner.create", diff --git a/src/audit-logs/data/ghes-3.15/organization.json b/src/audit-logs/data/ghes-3.15/organization.json index f697dad42c5f..dfa0c3024a8d 100644 --- a/src/audit-logs/data/ghes-3.15/organization.json +++ b/src/audit-logs/data/ghes-3.15/organization.json @@ -1040,7 +1040,7 @@ "operation_type", "actor_is_bot" ], - "docs_reference_titles": "GitHub Copilot billing" + "docs_reference_titles": "GitHub Copilot licenses" }, { "action": "copilot.plan_downgrade_scheduled", diff --git a/src/audit-logs/data/ghes-3.16/organization.json b/src/audit-logs/data/ghes-3.16/organization.json index 81433fee484a..930542f6572f 100644 --- a/src/audit-logs/data/ghes-3.16/organization.json +++ b/src/audit-logs/data/ghes-3.16/organization.json @@ -1147,7 +1147,7 @@ "operation_type", "actor_is_bot" ], - "docs_reference_titles": "GitHub Copilot billing" + "docs_reference_titles": "GitHub Copilot licenses" }, { "action": "copilot.plan_downgrade_scheduled", diff --git a/src/audit-logs/data/ghes-3.17/organization.json b/src/audit-logs/data/ghes-3.17/organization.json index c51ee90aba32..f6c39d5b802b 100644 --- a/src/audit-logs/data/ghes-3.17/organization.json +++ b/src/audit-logs/data/ghes-3.17/organization.json @@ -1269,7 +1269,7 @@ "operation_type", "actor_is_bot" ], - "docs_reference_titles": "GitHub Copilot billing" + "docs_reference_titles": "GitHub Copilot licenses" }, { "action": "copilot.plan_downgrade_scheduled", diff --git a/src/audit-logs/data/ghes-3.19/organization.json b/src/audit-logs/data/ghes-3.19/organization.json index 10547e24abb7..d67429e7ffbc 100644 --- a/src/audit-logs/data/ghes-3.19/organization.json +++ b/src/audit-logs/data/ghes-3.19/organization.json @@ -1387,7 +1387,7 @@ "operation_type", "actor_is_bot" ], - "docs_reference_titles": "GitHub Copilot billing" + "docs_reference_titles": "GitHub Copilot licenses" }, { "action": "copilot.plan_downgrade_scheduled", diff --git a/src/audit-logs/lib/config.json b/src/audit-logs/lib/config.json index cb6a9bfb8b23..c33fe681d229 100644 --- a/src/audit-logs/lib/config.json +++ b/src/audit-logs/lib/config.json @@ -9,5 +9,5 @@ "git": "Note: Git events have special access requirements and retention policies that differ from other audit log events. For GitHub Enterprise Cloud, access Git events via the REST API only with 7-day retention. For GitHub Enterprise Server, Git events must be enabled in audit log configuration and are not included in search results.", "sso_redirect": "Note: Automatically redirecting users to sign in is currently in beta for Enterprise Managed Users and subject to change." }, - "sha": "ff2be4f24eaeb83e0d054bcf1f2d36c5f8add0af" + "sha": "73af758b3ef22814e29e064415327dc0840f5ec8" } \ No newline at end of file diff --git a/src/content-linter/scripts/disable-rules.js b/src/content-linter/scripts/disable-rules.ts similarity index 57% rename from src/content-linter/scripts/disable-rules.js rename to src/content-linter/scripts/disable-rules.ts index 17be18f97756..cf0225f5c2e5 100755 --- a/src/content-linter/scripts/disable-rules.js +++ b/src/content-linter/scripts/disable-rules.ts @@ -9,7 +9,7 @@ import fs from 'fs' import { spawn } from 'child_process' -const rule = process.argv[2] +const rule: string | undefined = process.argv[2] if (!rule) { console.error('Please specify a rule to disable.') process.exit(1) @@ -38,36 +38,40 @@ const childProcess = spawn('npm', [ rule, ]) -childProcess.stdout.on('data', (data) => { +childProcess.stdout.on('data', (data: Buffer) => { if (verbose) console.log(data.toString()) }) -childProcess.stderr.on('data', function (data) { +childProcess.stderr.on('data', function (data: Buffer) { if (verbose) console.log(data.toString()) }) let matchingRulesFound = 0 -childProcess.on('close', (code) => { +childProcess.on('close', (code: number | null) => { if (code === 0) { console.log(`No violations for rule, "${rule}" found.`) process.exit(0) } - const markdownViolations = JSON.parse(fs.readFileSync('markdown-violations.json', 'utf8')) + const markdownViolations: Record> = JSON.parse( + fs.readFileSync('markdown-violations.json', 'utf8'), + ) console.log(`${Object.values(markdownViolations).flat().length} violations found.`) - Object.entries(markdownViolations).forEach(([fileName, results]) => { - console.log(fileName) - console.log(results) - const fileLines = fs.readFileSync(fileName, 'utf8').split('\n') - results.forEach((result) => { - matchingRulesFound++ - const lineIndex = result.lineNumber - 1 - const offendingLine = fileLines[lineIndex] - fileLines[lineIndex] = offendingLine.concat(` `) - }) - fs.writeFileSync(fileName, fileLines.join('\n'), 'utf8') - }) + Object.entries(markdownViolations).forEach( + ([fileName, results]: [string, Array<{ lineNumber: number }>]) => { + console.log(fileName) + console.log(results) + const fileLines = fs.readFileSync(fileName, 'utf8').split('\n') + results.forEach((result) => { + matchingRulesFound++ + const lineIndex = result.lineNumber - 1 + const offendingLine = fileLines[lineIndex] + fileLines[lineIndex] = offendingLine.concat(` `) + }) + fs.writeFileSync(fileName, fileLines.join('\n'), 'utf8') + }, + ) console.log(`${matchingRulesFound} violations ignored.`) }) diff --git a/src/content-linter/tests/unit/liquid-data-tags.js b/src/content-linter/tests/unit/liquid-data-tags.ts similarity index 87% rename from src/content-linter/tests/unit/liquid-data-tags.js rename to src/content-linter/tests/unit/liquid-data-tags.ts index 21a029aeaad3..faa423e1e504 100644 --- a/src/content-linter/tests/unit/liquid-data-tags.js +++ b/src/content-linter/tests/unit/liquid-data-tags.ts @@ -3,6 +3,7 @@ import path from 'path' import { afterAll, beforeAll, describe, expect, test } from 'vitest' import { runRule } from '../../lib/init-test' +import type { Rule } from '@/content-linter/types' import { liquidDataReferencesDefined, liquidDataTagFormat, @@ -31,7 +32,7 @@ describe(liquidDataReferencesDefined.names.join(' - '), () => { '{% data ui.nested.nested.not-there %}', '{% data some.random.path %}', ] - const result = await runRule(liquidDataReferencesDefined, { + const result = await runRule(liquidDataReferencesDefined as Rule, { strings: { markdown: markdown.join('\n') }, }) const errors = result.markdown @@ -45,7 +46,7 @@ describe(liquidDataReferencesDefined.names.join(' - '), () => { '{% data variables.location.product_location %}', '{% data ui.header.notices.release_candidate %}', ].join('\n') - const result = await runRule(liquidDataReferencesDefined, { strings: { markdown } }) + const result = await runRule(liquidDataReferencesDefined as Rule, { strings: { markdown } }) const errors = result.markdown expect(errors.length).toBe(0) }) @@ -57,7 +58,7 @@ describe(liquidDataReferencesDefined.names.join(' - '), () => { '{% data %}', '{% indented_data_reference %}', ] - const result = await runRule(liquidDataTagFormat, { + const result = await runRule(liquidDataTagFormat as Rule, { strings: { markdown: markdown.join('\n') }, }) const errors = result.markdown @@ -69,7 +70,7 @@ describe(liquidDataReferencesDefined.names.join(' - '), () => { '{% data ui.header.notices.release_candidate %}', '{% indented_data_reference ui.header.notices.release_candidate spaces=3 %}', ] - const result = await runRule(liquidDataTagFormat, { + const result = await runRule(liquidDataTagFormat as Rule, { strings: { markdown: markdown.join('\n') }, }) const errors = result.markdown diff --git a/src/content-linter/tests/unit/liquid-syntax.js b/src/content-linter/tests/unit/liquid-syntax.ts similarity index 100% rename from src/content-linter/tests/unit/liquid-syntax.js rename to src/content-linter/tests/unit/liquid-syntax.ts diff --git a/src/content-linter/tests/unit/liquid-tag-whitespace.js b/src/content-linter/tests/unit/liquid-tag-whitespace.ts similarity index 100% rename from src/content-linter/tests/unit/liquid-tag-whitespace.js rename to src/content-linter/tests/unit/liquid-tag-whitespace.ts diff --git a/src/content-render/scripts/render-content-markdown.js b/src/content-render/scripts/render-content-markdown.ts similarity index 85% rename from src/content-render/scripts/render-content-markdown.js rename to src/content-render/scripts/render-content-markdown.ts index 748445ef6786..a9cabc626775 100755 --- a/src/content-render/scripts/render-content-markdown.js +++ b/src/content-render/scripts/render-content-markdown.ts @@ -4,6 +4,7 @@ import { execSync } from 'child_process' import { renderLiquid } from '@/content-render/liquid/index' import shortVersionsMiddleware from '@/versions/middleware/short-versions' +import type { ExtendedRequest } from '@/types' const { loadPages } = await import('@/frame/lib/page-data.js') const { allVersions } = await import('@/versions/lib/all-versions.js') @@ -32,20 +33,20 @@ for (const page of pages) { console.log(`---\nStart: Creating directories for: ${page.relativePath}`) const dirnames = page.relativePath.substring(0, page.relativePath.lastIndexOf('/')) - fs.mkdirSync(`${contentCopilotDir}/${dirnames}`, { recursive: true }, (err) => { - if (err) throw err - }) + fs.mkdirSync(`${contentCopilotDir}/${dirnames}`, { recursive: true }) // Context needed to render the content liquid - const req = { language: 'en' } - const contextualize = (req) => { - req.context.currentVersionObj = req.context.allVersions[req.context.currentVersion] + const req = { language: 'en' } as ExtendedRequest + const contextualize = (req: ExtendedRequest): void => { + if (!req.context) return + if (!req.context.currentVersion) return + req.context.currentVersionObj = req.context.allVersions?.[req.context.currentVersion] shortVersionsMiddleware(req, null, () => {}) } req.context = { currentLanguage: 'en', currentVersion: 'free-pro-team@latest', - page: {}, + page: {} as any, // Empty page object used only for context initialization allVersions, } contextualize(req) @@ -77,7 +78,8 @@ for (const page of pages) { 'utf8', ) console.log(`Done: written file\n---`) - } catch (err) { + } catch (err: any) { + // Standard catch-all for error handling in scripts console.log(err) } } diff --git a/src/content-render/unified/alerts.js b/src/content-render/unified/alerts.ts similarity index 68% rename from src/content-render/unified/alerts.js rename to src/content-render/unified/alerts.ts index 67a9937eea93..dd9e3ecc7898 100644 --- a/src/content-render/unified/alerts.js +++ b/src/content-render/unified/alerts.ts @@ -4,9 +4,16 @@ Custom "Alerts", based on similar filter/styling in the monolith code. import { visit } from 'unist-util-visit' import { h } from 'hastscript' +// @ts-ignore - no types available for @primer/octicons import octicons from '@primer/octicons' +import type { Element } from 'hast' -const alertTypes = { +interface AlertType { + icon: string + color: string +} + +const alertTypes: Record = { NOTE: { icon: 'info', color: 'accent' }, IMPORTANT: { icon: 'report', color: 'done' }, WARNING: { icon: 'alert', color: 'attention' }, @@ -17,14 +24,17 @@ const alertTypes = { // Must contain one of [!NOTE], [!IMPORTANT], ... const ALERT_REGEXP = new RegExp(`\\[!(${Object.keys(alertTypes).join('|')})\\]`, 'gi') -const matcher = (node) => +// Using any due to conflicting unist/hast type definitions between dependencies +const matcher = (node: any): boolean => node.type === 'element' && node.tagName === 'blockquote' && ALERT_REGEXP.test(JSON.stringify(node.children)) -export default function alerts({ alertTitles = {} }) { - return (tree) => { - visit(tree, matcher, (node) => { +export default function alerts({ alertTitles = {} }: { alertTitles?: Record }) { + // Using any due to conflicting unist/hast type definitions between dependencies + return (tree: any) => { + // Using any due to conflicting unist/hast type definitions between dependencies + visit(tree, matcher, (node: any) => { const key = getAlertKey(node) if (!(key in alertTypes)) { console.warn( @@ -48,13 +58,14 @@ export default function alerts({ alertTitles = {} }) { } } -function getAlertKey(node) { +function getAlertKey(node: Element): string { const body = JSON.stringify(node.children) const matches = body.match(ALERT_REGEXP) - return matches[0].slice(2, -1) + return matches![0].slice(2, -1) } -function removeAlertSyntax(node) { +// Using any to handle both array and object node types recursively +function removeAlertSyntax(node: any): any { if (Array.isArray(node)) { return node.map(removeAlertSyntax) } @@ -67,7 +78,7 @@ function removeAlertSyntax(node) { return node } -function getOcticonSVG(name) { +function getOcticonSVG(name: string): Element { return h( 'svg', { @@ -78,6 +89,6 @@ function getOcticonSVG(name) { className: 'octicon mr-2', ariaHidden: true, }, - h('path', { d: octicons[name].heights[16].path.match(/d="(.*)"/)[1] }), + h('path', { d: octicons[name].heights[16].path.match(/d="(.*)"/)![1] }), ) } diff --git a/src/data-directory/lib/data-schemas/release-notes.js b/src/data-directory/lib/data-schemas/release-notes.ts similarity index 89% rename from src/data-directory/lib/data-schemas/release-notes.js rename to src/data-directory/lib/data-schemas/release-notes.ts index 1920d866b28f..d54ab86aeacf 100644 --- a/src/data-directory/lib/data-schemas/release-notes.js +++ b/src/data-directory/lib/data-schemas/release-notes.ts @@ -32,7 +32,7 @@ const section = { }, }, ], -} +} as const export default { type: 'object', @@ -69,7 +69,10 @@ export default { 'errata', 'closing_down', 'retired', - ].reduce((prev, curr) => ({ ...prev, [curr]: section }), {}), + ].reduce( + (prev: Record, curr: string) => ({ ...prev, [curr]: section }), + {}, + ), }, }, -} +} as const diff --git a/src/frame/components/ui/PermissionsStatement/PermissionsStatement.module.scss b/src/frame/components/ui/PermissionsStatement/PermissionsStatement.module.scss index 9e9db2a8dccb..e3dacf1da2b3 100644 --- a/src/frame/components/ui/PermissionsStatement/PermissionsStatement.module.scss +++ b/src/frame/components/ui/PermissionsStatement/PermissionsStatement.module.scss @@ -1,6 +1,5 @@ .permissionsBox { - border-radius: 0.625rem; - border-style: solid; - border-color: var(--borderColor-default); - padding: var(--base-size-16); + border-radius: 6px; + border: 1px solid var(--borderColor-default, var(--color-border-default)); + padding: 1rem; } diff --git a/src/frame/lib/permalink.js b/src/frame/lib/permalink.ts similarity index 80% rename from src/frame/lib/permalink.js rename to src/frame/lib/permalink.ts index 34b34d30f504..5c0c9fde0952 100644 --- a/src/frame/lib/permalink.js +++ b/src/frame/lib/permalink.ts @@ -28,13 +28,20 @@ page.permalinks is an array of objects that looks like this: ] */ class Permalink { - constructor(languageCode, pageVersion, relativePath, title) { + languageCode: string + pageVersion: string + relativePath: string + title: string + hrefWithoutLanguage: string + href: string + + constructor(languageCode: string, pageVersion: string, relativePath: string, title: string) { this.languageCode = languageCode this.pageVersion = pageVersion this.relativePath = relativePath this.title = title - const permalinkSuffix = this.constructor.relativePathToSuffix(relativePath) + const permalinkSuffix = Permalink.relativePathToSuffix(relativePath) this.hrefWithoutLanguage = removeFPTFromPath( path.posix.join('/', pageVersion, permalinkSuffix), @@ -46,18 +53,23 @@ class Permalink { return this } - static derive(languageCode, relativePath, title, applicableVersions) { + static derive( + languageCode: string, + relativePath: string, + title: string, + applicableVersions: string[], + ): Permalink[] { assert(relativePath, 'relativePath is required') assert(languageCode, 'languageCode is required') - const permalinks = applicableVersions.map((pageVersion) => { + const permalinks = applicableVersions.map((pageVersion: string) => { return new Permalink(languageCode, pageVersion, relativePath, title) }) return permalinks } - static relativePathToSuffix(relativePath) { + static relativePathToSuffix(relativePath: string): string { if (relativePath === 'index.md') return '/' // When you turn `foo/bar.md`, which is a file path, into a URL pathname, // you just need to chop off the `.md` suffix. diff --git a/src/frame/lib/read-frontmatter.js b/src/frame/lib/read-frontmatter.ts similarity index 81% rename from src/frame/lib/read-frontmatter.js rename to src/frame/lib/read-frontmatter.ts index fbf59ca98dd4..be21dbca6b41 100644 --- a/src/frame/lib/read-frontmatter.js +++ b/src/frame/lib/read-frontmatter.ts @@ -2,7 +2,12 @@ import matter from '@gr2m/gray-matter' import { validateJson } from '@/tests/lib/validate-json-schema' -function readFrontmatter(markdown, opts = {}) { +interface ReadFrontmatterOptions { + schema?: Record // Schema can have arbitrary properties for validation + filepath?: string | null +} + +function readFrontmatter(markdown: string, opts: ReadFrontmatterOptions = {}) { const schema = opts.schema || { type: 'object', properties: {} } const filepath = opts.filepath || null @@ -10,7 +15,7 @@ function readFrontmatter(markdown, opts = {}) { try { ;({ content, data } = matter(markdown)) - } catch (e) { + } catch (e: any) { const defaultReason = 'invalid frontmatter entry' const reason = e.reason @@ -21,7 +26,7 @@ function readFrontmatter(markdown, opts = {}) { : e.reason : defaultReason - const error = { + const error: any = { reason, message: 'YML parsing error!', } @@ -33,7 +38,7 @@ function readFrontmatter(markdown, opts = {}) { return { errors } } - const validate = validateJson(schema, data) + const validate: any = validateJson(schema, data) // Combine the AJV-supplied `instancePath` and `params` into a more user-friendly frontmatter path. // For example, given: @@ -44,7 +49,7 @@ function readFrontmatter(markdown, opts = {}) { // // The purpose is to help users understand that the error is on the `fpt` key within the `versions` object. // Note if the error is on a top-level FM property like `title`, the `instancePath` will be empty. - const cleanPropertyPath = (params, instancePath) => { + const cleanPropertyPath = (params: Record, instancePath: string) => { const mainProps = Object.values(params)[0] if (!instancePath) return mainProps @@ -55,8 +60,8 @@ function readFrontmatter(markdown, opts = {}) { const errors = [] if (!validate.isValid && filepath) { - const formattedErrors = validate.errors.map((error) => { - const userFriendly = {} + const formattedErrors = validate.errors.map((error: any) => { + const userFriendly: any = {} userFriendly.property = cleanPropertyPath(error.params, error.instancePath) userFriendly.message = error.message userFriendly.reason = error.keyword diff --git a/src/frame/middleware/cache-control.js b/src/frame/middleware/cache-control.ts similarity index 83% rename from src/frame/middleware/cache-control.js rename to src/frame/middleware/cache-control.ts index ad255d8b16e4..27a912def830 100644 --- a/src/frame/middleware/cache-control.js +++ b/src/frame/middleware/cache-control.ts @@ -1,3 +1,12 @@ +import type { Response } from 'express' + +interface CacheControlOptions { + key?: string + public_?: boolean + immutable?: boolean + maxAgeZero?: boolean +} + // Return a function you can pass a Response object to and it will // set the `Cache-Control` header. // @@ -11,9 +20,14 @@ // Max age is in seconds // Max age should not be greater than 31536000 https://www.ietf.org/rfc/rfc2616.txt function cacheControlFactory( - maxAge = 60 * 60, - { key = 'cache-control', public_ = true, immutable = false, maxAgeZero = false } = {}, -) { + maxAge: number = 60 * 60, + { + key = 'cache-control', + public_ = true, + immutable = false, + maxAgeZero = false, + }: CacheControlOptions = {}, +): (res: Response) => void { const directives = [ maxAge && public_ && 'public', maxAge && `max-age=${maxAge}`, @@ -26,7 +40,7 @@ function cacheControlFactory( ] .filter(Boolean) .join(', ') - return (res) => { + return (res: Response) => { if (process.env.NODE_ENV !== 'production' && res.hasHeader('set-cookie') && maxAge) { console.warn( "You can't set a >0 cache-control header AND set-cookie or else the CDN will never respect the cache-control.", @@ -50,7 +64,7 @@ const searchBrowserCacheControl = cacheControlFactory(60 * 60) const searchCdnCacheControl = cacheControlFactory(60 * 60 * 24, { key: 'surrogate-control', }) -export function searchCacheControl(res) { +export function searchCacheControl(res: Response): void { searchBrowserCacheControl(res) searchCdnCacheControl(res) } @@ -65,7 +79,7 @@ const defaultCDNCacheControl = cacheControlFactory(60 * 60 * 24, { const defaultBrowserCacheControl = cacheControlFactory(60) // A general default configuration that is useful to almost all responses // that can be cached. -export function defaultCacheControl(res) { +export function defaultCacheControl(res: Response): void { defaultCDNCacheControl(res) defaultBrowserCacheControl(res) } @@ -74,7 +88,7 @@ export function defaultCacheControl(res) { // x-user-language is a custom request header derived from req.cookie:user_language // accept-language is truncated to one of our available languages // https://bit.ly/3u5UeRN -export function languageCacheControl(res) { +export function languageCacheControl(res: Response): void { defaultCacheControl(res) res.set('vary', 'accept-language, x-user-language') } diff --git a/src/frame/tests/permalink.js b/src/frame/tests/permalink.ts similarity index 98% rename from src/frame/tests/permalink.js rename to src/frame/tests/permalink.ts index 136ed12fe80d..a1b9e99426de 100644 --- a/src/frame/tests/permalink.js +++ b/src/frame/tests/permalink.ts @@ -24,7 +24,7 @@ describe('Permalink class', () => { const homepagePermalink = permalinks.find( (permalink) => permalink.pageVersion === nonEnterpriseDefaultVersion, ) - expect(homepagePermalink.href).toBe('/en') + expect(homepagePermalink?.href).toBe('/en') }) test('derives info for non-enterprise versioned homepage', () => { diff --git a/src/frame/tests/site-tree.js b/src/frame/tests/site-tree.ts similarity index 77% rename from src/frame/tests/site-tree.js rename to src/frame/tests/site-tree.ts index 2e15fdf46957..1cfc0f286d2a 100644 --- a/src/frame/tests/site-tree.js +++ b/src/frame/tests/site-tree.ts @@ -6,6 +6,7 @@ import EnterpriseServerReleases from '@/versions/lib/enterprise-server-releases' import { loadSiteTree } from '@/frame/lib/page-data' import nonEnterpriseDefaultVersion from '@/versions/lib/non-enterprise-default-version' import { formatAjvErrors } from '@/tests/helpers/schemas' +import type { SiteTree, Tree } from '@/types' const latestEnterpriseRelease = EnterpriseServerReleases.latest @@ -14,9 +15,9 @@ const siteTreeValidate = getJsonValidator(schema.childPage) describe('siteTree', () => { vi.setConfig({ testTimeout: 3 * 60 * 1000 }) - let siteTree + let siteTree: SiteTree beforeAll(async () => { - siteTree = await loadSiteTree() + siteTree = (await loadSiteTree()) as SiteTree }) test('has language codes as top-level keys', () => { @@ -39,12 +40,12 @@ describe('siteTree', () => { // TODO: use new findPageInSiteTree helper when it's available const pageWithDynamicTitle = ghesSiteTree.childPages .find((child) => child.href === `/en/${ghesLatest}/admin`) - .childPages.find( + ?.childPages.find( (child) => child.href === `/en/${ghesLatest}/admin/installing-your-enterprise-server`, ) // Confirm the raw title contains Liquid - expect(pageWithDynamicTitle.page.title).toEqual( + expect(pageWithDynamicTitle?.page.title).toEqual( 'Installing {% data variables.product.prodname_enterprise %}', ) }) @@ -58,18 +59,22 @@ describe('siteTree', () => { }) }) -function validate(currentPage) { - ;(currentPage.childPages || []).forEach((childPage) => { +function validate(currentPage: Tree): void { + const childPages: Tree[] = currentPage.childPages || [] + childPages.forEach((childPage) => { + // Store page reference before validation to avoid type narrowing + const pageRef: Tree = childPage const isValid = siteTreeValidate(childPage) - let errors + let errors: string | undefined if (!isValid) { - errors = `file ${childPage.page.fullPath}: ${formatAjvErrors(siteTreeValidate.errors)}` + const fullPath = pageRef.page.fullPath + errors = `file ${fullPath}: ${formatAjvErrors(siteTreeValidate.errors || [])}` } expect(isValid, errors).toBe(true) // Run recursively until we run out of child pages - validate(childPage) + validate(pageRef) }) } diff --git a/src/ghes-releases/scripts/deprecate/update-content.ts b/src/ghes-releases/scripts/deprecate/update-content.ts index 8e6369fcd44b..86cf54309fee 100644 --- a/src/ghes-releases/scripts/deprecate/update-content.ts +++ b/src/ghes-releases/scripts/deprecate/update-content.ts @@ -58,7 +58,7 @@ export function updateContentFiles() { // To preserve newlines when stringifying, // you can set the lineWidth option to -1 // This prevents updates to the file that aren't actual changes. - fs.writeFileSync(file, frontmatter.stringify(content, data, { lineWidth: -1 } as any)) + fs.writeFileSync(file, frontmatter.stringify(content!, data, { lineWidth: -1 } as any)) continue } if (featureAppliesToAllVersions) { @@ -71,7 +71,7 @@ export function updateContentFiles() { // To preserve newlines when stringifying, // you can set the lineWidth option to -1 // This prevents updates to the file that aren't actual changes. - fs.writeFileSync(file, frontmatter.stringify(content, data, { lineWidth: -1 } as any)) + fs.writeFileSync(file, frontmatter.stringify(content!, data, { lineWidth: -1 } as any)) continue } @@ -94,7 +94,7 @@ export function updateContentFiles() { // Remove the ghes property from versions Fm and return delete data.versions.ghes console.log('Removing GHES version from: ', file) - fs.writeFileSync(file, frontmatter.stringify(content, data, { lineWidth: -1 } as any)) + fs.writeFileSync(file, frontmatter.stringify(content!, data, { lineWidth: -1 } as any)) } } } diff --git a/src/graphql/tests/validate-schema.js b/src/graphql/tests/validate-schema.ts similarity index 70% rename from src/graphql/tests/validate-schema.js rename to src/graphql/tests/validate-schema.ts index 7c192adb4f62..c6e86b4df762 100644 --- a/src/graphql/tests/validate-schema.js +++ b/src/graphql/tests/validate-schema.ts @@ -9,7 +9,9 @@ import { GRAPHQL_DATA_DIR } from '../lib/index' const allVersionValues = Object.values(allVersions) const graphqlVersions = allVersionValues.map((v) => v.openApiVersionName) -const graphqlTypes = readJsonFile('./src/graphql/lib/types.json').map((t) => t.kind) +const graphqlTypes = (readJsonFile('./src/graphql/lib/types.json') as Array<{ kind: string }>).map( + (t) => t.kind, +) const previewsValidate = getJsonValidator(previewsValidator) const upcomingChangesValidate = getJsonValidator(upcomingChangesValidator) @@ -20,9 +22,11 @@ describe('graphql json files', () => { // The typeObj is repeated thousands of times in each .json file // so use a cache of which we've already validated to speed this // test up significantly. - const typeObjsTested = new Set() + const typeObjsTested = new Set() graphqlVersions.forEach((version) => { - const schemaJsonPerVersion = readJsonFile(`${GRAPHQL_DATA_DIR}/${version}/schema.json`) + const schemaJsonPerVersion = readJsonFile( + `${GRAPHQL_DATA_DIR}/${version}/schema.json`, + ) as Record> // all graphql types are arrays except for queries graphqlTypes.forEach((type) => { test(`${version} schemas object validation for ${type}`, () => { @@ -31,12 +35,15 @@ describe('graphql json files', () => { if (typeObjsTested.has(key)) return typeObjsTested.add(key) - const { isValid, errors } = validateJson(schemaValidator[type], typeObj) + const { isValid, errors } = validateJson( + schemaValidator[type as keyof typeof schemaValidator], + typeObj, + ) - let formattedErrors = errors + let formattedErrors: any = errors // Can be either raw errors array or formatted string if (!isValid) { formattedErrors = `kind: ${typeObj.kind}, name: ${typeObj.name}: ${formatAjvErrors( - errors, + errors || [], )}` } @@ -48,13 +55,13 @@ describe('graphql json files', () => { test('previews object validation', () => { graphqlVersions.forEach((version) => { - const previews = readJsonFile(`${GRAPHQL_DATA_DIR}/${version}/previews.json`) + const previews = readJsonFile(`${GRAPHQL_DATA_DIR}/${version}/previews.json`) as Array // GraphQL preview schema structure is dynamic previews.forEach((preview) => { const isValid = previewsValidate(preview) - let errors + let errors: string | undefined if (!isValid) { - errors = formatAjvErrors(previewsValidate.errors) + errors = formatAjvErrors(previewsValidate.errors || []) } expect(isValid, errors).toBe(true) @@ -64,15 +71,17 @@ describe('graphql json files', () => { test('upcoming changes object validation', () => { graphqlVersions.forEach((version) => { - const upcomingChanges = readJsonFile(`${GRAPHQL_DATA_DIR}/${version}/upcoming-changes.json`) + const upcomingChanges = readJsonFile( + `${GRAPHQL_DATA_DIR}/${version}/upcoming-changes.json`, + ) as Record> // GraphQL change object structure is dynamic for (const changes of Object.values(upcomingChanges)) { // each object value is an array of changes changes.forEach((changeObj) => { const isValid = upcomingChangesValidate(changeObj) - let errors + let errors: string | undefined if (!isValid) { - errors = formatAjvErrors(upcomingChangesValidate.errors) + errors = formatAjvErrors(upcomingChangesValidate.errors || []) } expect(isValid, errors).toBe(true) diff --git a/src/metrics/scripts/docsaudit.ts b/src/metrics/scripts/docsaudit.ts index e053c746d75d..f37159959643 100644 --- a/src/metrics/scripts/docsaudit.ts +++ b/src/metrics/scripts/docsaudit.ts @@ -66,7 +66,7 @@ async function main(): Promise { for (const file of files) { const contents = await fs.promises.readFile(file) const contentPath = path.relative(ROOTDIR, file) - const { data } = readFrontmatter(contents) + const { data } = readFrontmatter(contents.toString()) const versionString = JSON.stringify(data?.versions || {}).replaceAll('"', "'") const pathToQuery = getPathToQuery(file) // Pass null to get all versions (the default if no version is provided) diff --git a/src/rest/data/ghes-3.14-2022-11-28/schema.json b/src/rest/data/ghes-3.14-2022-11-28/schema.json index 091e60b65b91..248e6d970eed 100644 --- a/src/rest/data/ghes-3.14-2022-11-28/schema.json +++ b/src/rest/data/ghes-3.14-2022-11-28/schema.json @@ -637,7 +637,6 @@ } ], "previews": [], - "descriptionHTML": "

Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for Location: in\nthe response header to find the URL for the download. The :archive_format must be zip.

\n

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "302", @@ -647,7 +646,8 @@ "httpStatusCode": "410", "description": "

Gone

" } - ] + ], + "descriptionHTML": "

Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for Location: in\nthe response header to find the URL for the download. The :archive_format must be zip.

\n

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -8705,13 +8705,13 @@ } ], "previews": [], + "descriptionHTML": "

Get the public key for an environment, which you need to encrypt environment\nsecrets. You need to encrypt a secret before you can create or update secrets.

\n

Anyone with read access to the repository can use this endpoint.

\n

If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "

Get the public key for an environment, which you need to encrypt environment\nsecrets. You need to encrypt a secret before you can create or update secrets.

\n

Anyone with read access to the repository can use this endpoint.

\n

If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -9784,13 +9784,13 @@ } ], "previews": [], + "descriptionHTML": "

Deletes a self-hosted runner group for an enterprise.

\n

OAuth app tokens and personal access tokens (classic) need the manage_runners:enterprise scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ], - "descriptionHTML": "

Deletes a self-hosted runner group for an enterprise.

\n

OAuth app tokens and personal access tokens (classic) need the manage_runners:enterprise scope to use this endpoint.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -13171,13 +13171,13 @@ } ], "previews": [], - "descriptionHTML": "

Replaces the list of self-hosted runners that are part of an organization runner group.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Replaces the list of self-hosted runners that are part of an organization runner group.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -27432,13 +27432,13 @@ } ], "previews": [], + "descriptionHTML": "

Gets a specific variable in an environment.

\n

Authenticated users must have collaborator access to a repository to create, update, or read variables.

\n

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "

Gets a specific variable in an environment.

\n

Authenticated users must have collaborator access to a repository to create, update, or read variables.

\n

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -38426,13 +38426,13 @@ } ], "previews": [], + "descriptionHTML": "

Approve or reject custom deployment protection rules provided by a GitHub App for a workflow run. For more information, see \"Using environments for deployment.\"

\n

Note

\n

\nGitHub Apps can only review their own custom deployment protection rules. To approve or reject pending deployments that are waiting for review from a specific person or team, see POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments.

\n
\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ], - "descriptionHTML": "

Approve or reject custom deployment protection rules provided by a GitHub App for a workflow run. For more information, see \"Using environments for deployment.\"

\n

Note

\n

\nGitHub Apps can only review their own custom deployment protection rules. To approve or reject pending deployments that are waiting for review from a specific person or team, see POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments.

\n
\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -39331,13 +39331,13 @@ } ], "previews": [], + "descriptionHTML": "

Get all deployment environments for a workflow run that are waiting for protection rules to pass.

\n

Anyone with read access to the repository can use this endpoint.

\n

If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "

Get all deployment environments for a workflow run that are waiting for protection rules to pass.

\n

Anyone with read access to the repository can use this endpoint.

\n

If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -40292,13 +40292,13 @@ } ], "previews": [], + "descriptionHTML": "

Re-runs your workflow run using its id.

\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "201", "description": "

Created

" } - ], - "descriptionHTML": "

Re-runs your workflow run using its id.

\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -75438,13 +75438,13 @@ } ], "previews": [], - "descriptionHTML": "

These are events that you've received by watching repositories and following users. If you are authenticated as the\ngiven user, you will see private events. Otherwise, you'll only see public events.

\n

Note

\n

\nThis API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.

\n
", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

These are events that you've received by watching repositories and following users. If you are authenticated as the\ngiven user, you will see private events. Otherwise, you'll only see public events.

\n

Note

\n

\nThis API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.

\n
" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -79378,13 +79378,13 @@ } ], "previews": [], - "descriptionHTML": "

Note

\n

\nThis API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.

\n
", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Note

\n

\nThis API is not built to serve real-time use cases. Depending on the time of day, event latency can be anywhere from 30s to 6h.

\n
" } ], "feeds": [ @@ -80875,6 +80875,7 @@ } ], "previews": [], + "descriptionHTML": "

Marks all notifications as \"read\" for the current user. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub Enterprise Server will run an asynchronous process to mark notifications as \"read.\" To check whether any \"unread\" notifications remain, you can use the List notifications for the authenticated user endpoint and pass the query parameter all=false.

", "statusCodes": [ { "httpStatusCode": "202", @@ -80896,8 +80897,7 @@ "httpStatusCode": "403", "description": "

Forbidden

" } - ], - "descriptionHTML": "

Marks all notifications as \"read\" for the current user. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub Enterprise Server will run an asynchronous process to mark notifications as \"read.\" To check whether any \"unread\" notifications remain, you can use the List notifications for the authenticated user endpoint and pass the query parameter all=false.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -83452,13 +83452,13 @@ } ], "previews": [], + "descriptionHTML": "

Lists all notifications for the current user in the specified repository.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "

Lists all notifications for the current user in the specified repository.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -89719,13 +89719,13 @@ } ], "previews": [], - "descriptionHTML": "

This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, set the repository's subscription manually.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, set the repository's subscription manually.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -120662,7 +120662,6 @@ } ], "previews": [], - "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "201", @@ -120688,7 +120687,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "" } ], "branch-protection": [ @@ -126248,7 +126248,6 @@ } ], "previews": [], - "descriptionHTML": "

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

\n

Protecting a branch requires admin or owner permissions to the repository.

\n

Note

\n

\nPassing new arrays of users and teams replaces their previous values.

\n
\n

Note

\n

\nThe list of users, apps, and teams in total is limited to 100 items.

\n
", "statusCodes": [ { "httpStatusCode": "200", @@ -126266,7 +126265,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

\n

Protecting a branch requires admin or owner permissions to the repository.

\n

Note

\n

\nPassing new arrays of users and teams replaces their previous values.

\n
\n

Note

\n

\nThe list of users, apps, and teams in total is limited to 100 items.

\n
" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -130824,7 +130824,6 @@ } ], "previews": [], - "descriptionHTML": "

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

\n

When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits.

", "statusCodes": [ { "httpStatusCode": "200", @@ -130834,7 +130833,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

\n

When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -151367,13 +151367,13 @@ } ], "previews": [], - "descriptionHTML": "

Changes the default automatic flow when creating check suites. By default, a check suite is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually Create a check suite.\nYou must have admin permissions in the repository to set preferences for check suites.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Changes the default automatic flow when creating check suites. By default, a check suite is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually Create a check suite.\nYou must have admin permissions in the repository to set preferences for check suites.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -164054,7 +164054,6 @@ } ], "previews": [], - "descriptionHTML": "

For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.\nThe permissions hash returned in the response contains the base role permissions of the collaborator. The role_name is the highest role assigned to the collaborator after considering all sources of grants, including: repo, teams, organization, and enterprise.\nThere is presently not a way to differentiate between an organization level grant and a repository level grant from this endpoint response.

\n

Team members will include the members of child teams.

\n

The authenticated user must have write, maintain, or admin privileges on the repository to use this endpoint. For organization-owned repositories, the authenticated user needs to be a member of the organization.\nOAuth app tokens and personal access tokens (classic) need the read:org and repo scopes to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", @@ -164064,7 +164063,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.\nThe permissions hash returned in the response contains the base role permissions of the collaborator. The role_name is the highest role assigned to the collaborator after considering all sources of grants, including: repo, teams, organization, and enterprise.\nThere is presently not a way to differentiate between an organization level grant and a repository level grant from this endpoint response.

\n

Team members will include the members of child teams.

\n

The authenticated user must have write, maintain, or admin privileges on the repository to use this endpoint. For organization-owned repositories, the authenticated user needs to be a member of the organization.\nOAuth app tokens and personal access tokens (classic) need the read:org and repo scopes to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -191314,13 +191314,13 @@ } ], "previews": [], - "descriptionHTML": "

Replaces all repositories for an organization secret when the visibility\nfor repository access is set to selected. The visibility is set when you Create\nor update an organization secret.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Replaces all repositories for an organization secret when the visibility\nfor repository access is set to selected. The visibility is set when you Create\nor update an organization secret.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -192013,13 +192013,13 @@ } ], "previews": [], + "descriptionHTML": "

Deletes a secret in a repository using the secret name.

\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ], - "descriptionHTML": "

Deletes a secret in a repository using the secret name.

\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

" + ] } ] }, @@ -193246,7 +193246,6 @@ } ], "previews": [], - "descriptionHTML": "

You can create a read-only deploy key.

", "statusCodes": [ { "httpStatusCode": "201", @@ -193256,7 +193255,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

You can create a read-only deploy key.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -193386,7 +193386,6 @@ } ], "previews": [], - "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "200", @@ -193396,7 +193395,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -200345,13 +200345,13 @@ } ], "previews": [], + "descriptionHTML": "

Disables a custom deployment protection rule for an environment.

\n

The authenticated user must have admin or owner permissions to the repository to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ], - "descriptionHTML": "

Disables a custom deployment protection rule for an environment.

\n

The authenticated user must have admin or owner permissions to the repository to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

" + ] } ], "statuses": [ @@ -202069,6 +202069,7 @@ } ], "previews": [], + "descriptionHTML": "

Users with push access can create deployment statuses for a given deployment.

\n

OAuth app tokens and personal access tokens (classic) need the repo_deployment scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "201", @@ -202078,8 +202079,7 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ], - "descriptionHTML": "

Users with push access can create deployment statuses for a given deployment.

\n

OAuth app tokens and personal access tokens (classic) need the repo_deployment scope to use this endpoint.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -205411,13 +205411,13 @@ } ], "previews": [], + "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -207224,13 +207224,13 @@ } ], "previews": [], + "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -208513,13 +208513,13 @@ } ], "previews": [], - "descriptionHTML": "

Note that this API call does not automatically initiate an LDAP sync. Rather, if a 201 is returned, the sync job is queued successfully, and is performed when the instance is ready.

", "statusCodes": [ { "httpStatusCode": "201", "description": "

Created

" } - ] + ], + "descriptionHTML": "

Note that this API call does not automatically initiate an LDAP sync. Rather, if a 201 is returned, the sync job is queued successfully, and is performed when the instance is ready.

" } ], "license": [ @@ -208598,13 +208598,13 @@ } ], "previews": [], - "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "" } ], "manage-ghes": [ @@ -208839,7 +208839,6 @@ } ], "previews": [], - "descriptionHTML": "

Deletes a SSH key from the authorized_keys file for your GitHub Enterprise Server instance. This will remove access via SSH to your instance. For more information, see \"Accessing the administrative shell (SSH).\"

", "statusCodes": [ { "httpStatusCode": "200", @@ -208857,7 +208856,8 @@ "httpStatusCode": "500", "description": "

Internal error

" } - ] + ], + "descriptionHTML": "

Deletes a SSH key from the authorized_keys file for your GitHub Enterprise Server instance. This will remove access via SSH to your instance. For more information, see \"Accessing the administrative shell (SSH).\"

" }, { "serverUrl": "http(s)://HOSTNAME", @@ -211495,6 +211495,7 @@ } ], "previews": [], + "descriptionHTML": "

Note

\n

\nThe request body for this operation must be submitted as application/x-www-form-urlencoded data. You can submit a parameter value as a string, or you can use a tool such as curl to submit a parameter value as the contents of a text file. For more information, see the curl documentation.

\n
", "statusCodes": [ { "httpStatusCode": "200", @@ -211504,8 +211505,7 @@ "httpStatusCode": "401", "description": "

Unauthorized

" } - ], - "descriptionHTML": "

Note

\n

\nThe request body for this operation must be submitted as application/x-www-form-urlencoded data. You can submit a parameter value as a string, or you can use a tool such as curl to submit a parameter value as the contents of a text file. For more information, see the curl documentation.

\n
" + ] }, { "serverUrl": "http(s)://HOSTNAME", @@ -212527,7 +212527,6 @@ } ], "previews": [], - "descriptionHTML": "

This API upgrades your license and also triggers the configuration process.

\n

Note

\n

\nThe request body for this operation must be submitted as multipart/form-data data. You can can reference the license file by prefixing the filename with the @ symbol using curl. For more information, see the curl documentation.

\n
", "statusCodes": [ { "httpStatusCode": "202", @@ -212537,7 +212536,8 @@ "httpStatusCode": "401", "description": "

Unauthorized

" } - ] + ], + "descriptionHTML": "

This API upgrades your license and also triggers the configuration process.

\n

Note

\n

\nThe request body for this operation must be submitted as multipart/form-data data. You can can reference the license file by prefixing the filename with the @ symbol using curl. For more information, see the curl documentation.

\n
" } ], "org-pre-receive-hooks": [ @@ -213524,13 +213524,13 @@ } ], "previews": [], - "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "201", "description": "

Created

" } - ] + ], + "descriptionHTML": "" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -213920,6 +213920,7 @@ } ], "previews": [], + "descriptionHTML": "

Triggers a new download of the environment tarball from the environment's image_url. When the download is finished, the newly downloaded tarball will overwrite the existing environment.

\n

If a download cannot be triggered, you will receive a 422 Unprocessable Entity response.

\n

The possible error messages are:

\n
    \n
  • Cannot modify or delete the default environment
  • \n
  • Can not start a new download when a download is in progress
  • \n
", "statusCodes": [ { "httpStatusCode": "202", @@ -213929,8 +213930,7 @@ "httpStatusCode": "422", "description": "

Client Errors

" } - ], - "descriptionHTML": "

Triggers a new download of the environment tarball from the environment's image_url. When the download is finished, the newly downloaded tarball will overwrite the existing environment.

\n

If a download cannot be triggered, you will receive a 422 Unprocessable Entity response.

\n

The possible error messages are:

\n
    \n
  • Cannot modify or delete the default environment
  • \n
  • Can not start a new download when a download is in progress
  • \n
" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -224531,13 +224531,13 @@ } ], "previews": [], - "descriptionHTML": "

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see \"HTTP method.\"

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see \"HTTP method.\"

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -248869,6 +248869,7 @@ } ], "previews": [], + "descriptionHTML": "

List issues in an organization assigned to the authenticated user.

\n

Note

\n

\nGitHub's REST API considers every pull request an issue, but not every issue is a pull request. For this reason, \"Issues\" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key. Be aware that the id of a pull request returned from \"Issues\" endpoints will be an issue id. To find out the pull request id, use the \"List pull requests\" endpoint.

\n
\n

This endpoint supports the following custom media types. For more information, see \"Media types.\"

\n
    \n
  • application/vnd.github.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
  • \n
  • application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • \n
  • application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • \n
  • application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
  • \n
", "statusCodes": [ { "httpStatusCode": "200", @@ -248878,8 +248879,7 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ], - "descriptionHTML": "

List issues in an organization assigned to the authenticated user.

\n

Note

\n

\nGitHub's REST API considers every pull request an issue, but not every issue is a pull request. For this reason, \"Issues\" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key. Be aware that the id of a pull request returned from \"Issues\" endpoints will be an issue id. To find out the pull request id, use the \"List pull requests\" endpoint.

\n
\n

This endpoint supports the following custom media types. For more information, see \"Media types.\"

\n
    \n
  • application/vnd.github.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
  • \n
  • application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • \n
  • application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • \n
  • application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
  • \n
" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -271984,13 +271984,13 @@ } ], "previews": [], - "descriptionHTML": "

Removes one or more assignees from an issue.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Removes one or more assignees from an issue.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -318768,7 +318768,6 @@ } ], "previews": [], - "descriptionHTML": "

List all timeline events for an issue.

", "statusCodes": [ { "httpStatusCode": "200", @@ -318782,7 +318781,8 @@ "httpStatusCode": "410", "description": "

Gone

" } - ] + ], + "descriptionHTML": "

List all timeline events for an issue.

" } ] }, @@ -319842,13 +319842,13 @@ } ], "previews": [], + "descriptionHTML": "

Get Hypermedia links to resources accessible in GitHub's REST API

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "

Get Hypermedia links to resources accessible in GitHub's REST API

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -325525,7 +325525,6 @@ } ], "previews": [], - "descriptionHTML": "

Fetches the URL to a migration archive.

", "statusCodes": [ { "httpStatusCode": "302", @@ -325535,7 +325534,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Fetches the URL to a migration archive.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -330706,6 +330706,7 @@ } ], "previews": [], + "descriptionHTML": "

Lists all the repositories for this user migration.

", "statusCodes": [ { "httpStatusCode": "200", @@ -330715,8 +330716,7 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ], - "descriptionHTML": "

Lists all the repositories for this user migration.

" + ] } ] }, @@ -331046,7 +331046,6 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nClosing down notice: GitHub Enterprise Server will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November 13, 2020. For more information, including scheduled brownouts, see the blog post.

\n
\n

You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the list your authorizations API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on the application authorizations settings screen within GitHub. The scopes returned are the union of scopes authorized for the application. For example, if an application has one token with repo scope and another token with user scope, the grant will return [\"repo\", \"user\"].

", "statusCodes": [ { "httpStatusCode": "200", @@ -331068,7 +331067,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nClosing down notice: GitHub Enterprise Server will discontinue the OAuth Authorizations API, which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our web application flow. The OAuth Authorizations API will be removed on November 13, 2020. For more information, including scheduled brownouts, see the blog post.

\n
\n

You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the list your authorizations API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on the application authorizations settings screen within GitHub. The scopes returned are the union of scopes authorized for the application. For example, if an application has one token with repo scope and another token with user scope, the grant will return [\"repo\", \"user\"].

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -341723,13 +341723,13 @@ } ], "previews": [], + "descriptionHTML": "

Gets the audit log for an organization. For more information, see \"Reviewing the audit log for your organization.\"

\n

By default, the response includes up to 30 events from the past three months. Use the phrase parameter to filter results and retrieve older events. For example, use the phrase parameter with the created qualifier to filter events based on when the events occurred. For more information, see \"Reviewing the audit log for your organization.\"

\n

Use pagination to retrieve fewer or more than 30 events. For more information, see \"Using pagination in the REST API.\"

\n

The authenticated user must be an organization owner to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need the read:audit_log scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "

Gets the audit log for an organization. For more information, see \"Reviewing the audit log for your organization.\"

\n

By default, the response includes up to 30 events from the past three months. Use the phrase parameter to filter results and retrieve older events. For example, use the phrase parameter with the created qualifier to filter events based on when the events occurred. For more information, see \"Reviewing the audit log for your organization.\"

\n

Use pagination to retrieve fewer or more than 30 events. For more information, see \"Using pagination in the REST API.\"

\n

The authenticated user must be an organization owner to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need the read:audit_log scope to use this endpoint.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -343328,13 +343328,13 @@ } ], "previews": [], + "descriptionHTML": "

List public organization memberships for the specified user.

\n

This method only lists public memberships, regardless of authentication. If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the List organizations for the authenticated user API instead.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "

List public organization memberships for the specified user.

\n

This method only lists public memberships, regardless of authentication. If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the List organizations for the authenticated user API instead.

" + ] } ], "custom-properties": [ @@ -344949,13 +344949,13 @@ } ], "previews": [], + "descriptionHTML": "

Warning

\n

\nClosing down notice: This operation is closing down and will be removed in the future. Use the \"List custom repository roles\" endpoint instead.

\n
\n

List the custom repository roles available in this organization. For more information on custom repository roles, see \"About custom repository roles.\"

\n

The authenticated user must be administrator of the organization or of a repository of the organization to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org or repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

Response - list of custom role names

" } - ], - "descriptionHTML": "

Warning

\n

\nClosing down notice: This operation is closing down and will be removed in the future. Use the \"List custom repository roles\" endpoint instead.

\n
\n

List the custom repository roles available in this organization. For more information on custom repository roles, see \"About custom repository roles.\"

\n

The authenticated user must be administrator of the organization or of a repository of the organization to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org or repo scope to use this endpoint.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -346812,6 +346812,7 @@ } ], "previews": [], + "descriptionHTML": "

List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned.

", "statusCodes": [ { "httpStatusCode": "200", @@ -346821,8 +346822,7 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ], - "descriptionHTML": "

List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -346953,6 +346953,7 @@ } ], "previews": [], + "descriptionHTML": "

Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories.

\n

Note

\n

\nIf a user has both direct membership in the organization as well as indirect membership via an enterprise team, only their direct membership will be removed. Their indirect membership via an enterprise team remains until the user is removed from the enterprise team.

\n
", "statusCodes": [ { "httpStatusCode": "204", @@ -346962,8 +346963,7 @@ "httpStatusCode": "403", "description": "

Forbidden

" } - ], - "descriptionHTML": "

Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories.

\n

Note

\n

\nIf a user has both direct membership in the organization as well as indirect membership via an enterprise team, only their direct membership will be removed. Their indirect membership via an enterprise team remains until the user is removed from the enterprise team.

\n
" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -351566,7 +351566,6 @@ } ], "previews": [], - "descriptionHTML": "

Gets an organization role that is available to this organization. For more information on organization roles, see \"Using organization roles.\"

\n

To use this endpoint, the authenticated user must be one of:

\n
    \n
  • An administrator for the organization.
  • \n
  • A user, or a user on a team, with the fine-grained permissions of read_organization_custom_org_role in the organization.
  • \n
\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", @@ -351580,7 +351579,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Gets an organization role that is available to this organization. For more information on organization roles, see \"Using organization roles.\"

\n

To use this endpoint, the authenticated user must be one of:

\n
    \n
  • An administrator for the organization.
  • \n
  • A user, or a user on a team, with the fine-grained permissions of read_organization_custom_org_role in the organization.
  • \n
\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -366177,6 +366177,7 @@ } ], "previews": [], + "descriptionHTML": "

Redeliver a delivery for a webhook configured in an organization.

\n

You must be an organization owner to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need admin:org_hook scope. OAuth apps cannot list, view, or edit\nwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps.

", "statusCodes": [ { "httpStatusCode": "202", @@ -366190,8 +366191,7 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ], - "descriptionHTML": "

Redeliver a delivery for a webhook configured in an organization.

\n

You must be an organization owner to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need admin:org_hook scope. OAuth apps cannot list, view, or edit\nwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -372007,13 +372007,13 @@ } ], "previews": [], - "descriptionHTML": "

Lists all packages that are owned by the authenticated user within the user's namespace, and that encountered a conflict during a Docker migration.

\n

OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Lists all packages that are owned by the authenticated user within the user's namespace, and that encountered a conflict during a Docker migration.

\n

OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -374560,6 +374560,7 @@ } ], "previews": [], + "descriptionHTML": "

Deletes a package owned by the authenticated user. You cannot delete a public package if any version of the package has more than 5,000 downloads. In this scenario, contact GitHub support for further assistance.

\n

OAuth app tokens and personal access tokens (classic) need the read:packages and delete:packages scopes to use this endpoint. For more information, see \"About permissions for GitHub Packages.\"

", "statusCodes": [ { "httpStatusCode": "204", @@ -374577,8 +374578,7 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ], - "descriptionHTML": "

Deletes a package owned by the authenticated user. You cannot delete a public package if any version of the package has more than 5,000 downloads. In this scenario, contact GitHub support for further assistance.

\n

OAuth app tokens and personal access tokens (classic) need the read:packages and delete:packages scopes to use this endpoint. For more information, see \"About permissions for GitHub Packages.\"

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -375170,13 +375170,13 @@ } ], "previews": [], - "descriptionHTML": "

Gets a specific package version for a package owned by the authenticated user.

\n

OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see \"About permissions for GitHub Packages.\"

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Gets a specific package version for a package owned by the authenticated user.

\n

OAuth app tokens and personal access tokens (classic) need the read:packages scope to use this endpoint. For more information, see \"About permissions for GitHub Packages.\"

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -379955,6 +379955,7 @@ } ], "previews": [], + "descriptionHTML": "

Restores a specific package version for a user.

\n

You can restore a deleted package under the following conditions:

\n
    \n
  • The package was deleted within the last 30 days.
  • \n
  • The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.
  • \n
\n

If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see \"About permissions for GitHub Packages.\"

\n

OAuth app tokens and personal access tokens (classic) need the read:packages and write:packages scopes to use this endpoint. For more information, see \"About permissions for GitHub Packages.\"

", "statusCodes": [ { "httpStatusCode": "204", @@ -379972,8 +379973,7 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ], - "descriptionHTML": "

Restores a specific package version for a user.

\n

You can restore a deleted package under the following conditions:

\n
    \n
  • The package was deleted within the last 30 days.
  • \n
  • The same package namespace and version is still available and not reused for a new package. If the same package namespace is not available, you will not be able to restore your package. In this scenario, to restore the deleted package, you must delete the new package that uses the deleted package's namespace first.
  • \n
\n

If the package_type belongs to a GitHub Packages registry that supports granular permissions, the authenticated user must have admin permissions to the package. For the list of these registries, see \"About permissions for GitHub Packages.\"

\n

OAuth app tokens and personal access tokens (classic) need the read:packages and write:packages scopes to use this endpoint. For more information, see \"About permissions for GitHub Packages.\"

" + ] } ] }, @@ -381880,13 +381880,13 @@ } ], "previews": [], - "descriptionHTML": "

Gets information about a GitHub Enterprise Server Pages build.

\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Gets information about a GitHub Enterprise Server Pages build.

\n

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -384416,7 +384416,6 @@ } ], "previews": [], - "descriptionHTML": "

Removes a collaborator from an organization project. You must be an organization owner or a project admin to remove a collaborator.

", "statusCodes": [ { "httpStatusCode": "204", @@ -384442,7 +384441,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Removes a collaborator from an organization project. You must be an organization owner or a project admin to remove a collaborator.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -385990,7 +385990,6 @@ } ], "previews": [], - "descriptionHTML": "

Lists the projects in an organization. Returns a 404 Not Found status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a 401 Unauthorized or 410 Gone status is returned.

", "statusCodes": [ { "httpStatusCode": "200", @@ -386000,7 +385999,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Lists the projects in an organization. Returns a 404 Not Found status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a 401 Unauthorized or 410 Gone status is returned.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -409820,7 +409820,6 @@ } ], "previews": [], - "descriptionHTML": "

Lists the files in a specified pull request.

\n

Note

\n

\nResponses include a maximum of 3000 files. The paginated response returns 30 files per page by default.

\n
\n

This endpoint supports the following custom media types. For more information, see \"Media types.\"

\n
    \n
  • application/vnd.github.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
  • \n
  • application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • \n
  • application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • \n
  • application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
  • \n
", "statusCodes": [ { "httpStatusCode": "200", @@ -409838,7 +409837,8 @@ "httpStatusCode": "503", "description": "

Service unavailable

" } - ] + ], + "descriptionHTML": "

Lists the files in a specified pull request.

\n

Note

\n

\nResponses include a maximum of 3000 files. The paginated response returns 30 files per page by default.

\n
\n

This endpoint supports the following custom media types. For more information, see \"Media types.\"

\n
    \n
  • application/vnd.github.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
  • \n
  • application/vnd.github.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • \n
  • application/vnd.github.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • \n
  • application/vnd.github.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
  • \n
" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -412171,13 +412171,13 @@ } ], "previews": [], - "descriptionHTML": "

Edits the content of a specified review comment.

\n

This endpoint supports the following custom media types. For more information, see \"Media types.\"

\n
    \n
  • application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
  • \n
  • application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • \n
  • application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • \n
  • application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
  • \n
", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Edits the content of a specified review comment.

\n

This endpoint supports the following custom media types. For more information, see \"Media types.\"

\n
    \n
  • application/vnd.github-commitcomment.raw+json: Returns the raw markdown body. Response will include body. This is the default if you do not pass any specific media type.
  • \n
  • application/vnd.github-commitcomment.text+json: Returns a text only representation of the markdown body. Response will include body_text.
  • \n
  • application/vnd.github-commitcomment.html+json: Returns HTML rendered from the body's markdown. Response will include body_html.
  • \n
  • application/vnd.github-commitcomment.full+json: Returns raw, text, and HTML representations. Response will include body, body_text, and body_html.
  • \n
" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -435715,7 +435715,6 @@ } ], "previews": [], - "descriptionHTML": "

List the reactions to a release.

", "statusCodes": [ { "httpStatusCode": "200", @@ -435725,7 +435724,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

List the reactions to a release.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -436334,7 +436334,6 @@ } ], "previews": [], - "descriptionHTML": "

Create a reaction to a release. A response with a Status: 200 OK means that you already added the reaction type to this release.

", "statusCodes": [ { "httpStatusCode": "200", @@ -436348,7 +436347,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Create a reaction to a release. A response with a Status: 200 OK means that you already added the reaction type to this release.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -439445,7 +439445,6 @@ } ], "previews": [], - "descriptionHTML": "

Users with push access to the repository can create a release.

\n

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see \"Rate limits for the API\" and \"Best practices for using the REST API.\"

", "statusCodes": [ { "httpStatusCode": "201", @@ -439455,7 +439454,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Users with push access to the repository can create a release.

\n

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see \"Rate limits for the API\" and \"Best practices for using the REST API.\"

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -443604,13 +443604,13 @@ } ], "previews": [], - "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -460616,7 +460616,6 @@ } ], "previews": [], - "descriptionHTML": "

List any syntax errors that are detected in the CODEOWNERS\nfile.

\n

For more information about the correct CODEOWNERS syntax,\nsee \"About code owners.\"

", "statusCodes": [ { "httpStatusCode": "200", @@ -460626,7 +460625,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

List any syntax errors that are detected in the CODEOWNERS\nfile.

\n

For more information about the correct CODEOWNERS syntax,\nsee \"About code owners.\"

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -461322,13 +461322,13 @@ } ], "previews": [], + "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -463044,13 +463044,13 @@ } ], "previews": [], - "descriptionHTML": "

A transfer request will need to be accepted by the new owner when transferring a personal repository to another user. The response will contain the original owner, and the transfer will continue asynchronously. For more details on the requirements to transfer personal and organization-owned repositories, see about repository transfers.

", "statusCodes": [ { "httpStatusCode": "202", "description": "

Accepted

" } - ] + ], + "descriptionHTML": "

A transfer request will need to be accepted by the new owner when transferring a personal repository to another user. The response will contain the original owner, and the transfer will continue asynchronously. For more details on the requirements to transfer personal and organization-owned repositories, see about repository transfers.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -463240,13 +463240,13 @@ } ], "previews": [], + "descriptionHTML": "

Disables dependency alerts for a repository.\nThe authenticated user must have admin access to the repository. For more information,\nsee \"About security alerts for vulnerable dependencies\".

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ], - "descriptionHTML": "

Disables dependency alerts for a repository.\nThe authenticated user must have admin access to the repository. For more information,\nsee \"About security alerts for vulnerable dependencies\".

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -467924,14 +467924,14 @@ } ], "descriptionHTML": "

Creates a new repository using a repository template. Use the template_owner and template_repo route parameters to specify the repository to use as the template. If the repository is not public, the authenticated user must own or be a member of an organization that owns the repository. To check if a repository is available to use as a template, get the repository's information using the Get a repository endpoint and check that the is_template key is true.

\n

OAuth app tokens and personal access tokens (classic) need the public_repo or repo scope to create a public repository, and repo scope to create a private repository.

", + "previews": [ + "

Creating and using repository templates is currently available for developers to preview. To access this new endpoint during the preview period, you must provide a custom media type in the Accept header:

\n
application/vnd.github.baptiste-preview+json\n
" + ], "statusCodes": [ { "httpStatusCode": "201", "description": "

Created

" } - ], - "previews": [ - "

Creating and using repository templates is currently available for developers to preview. To access this new endpoint during the preview period, you must provide a custom media type in the Accept header:

\n
application/vnd.github.baptiste-preview+json\n
" ] }, { @@ -519973,7 +519973,6 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the Get a team by name endpoint.

\n
", "statusCodes": [ { "httpStatusCode": "200", @@ -519983,7 +519982,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the Get a team by name endpoint.

\n
" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -529821,13 +529821,13 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a discussion comment endpoint.

\n
\n

Deletes a comment on a team discussion.

\n

OAuth app tokens and personal access tokens (classic) need the write:discussion scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a discussion comment endpoint.

\n
\n

Deletes a comment on a team discussion.

\n

OAuth app tokens and personal access tokens (classic) need the write:discussion scope to use this endpoint.

" } ], "discussions": [ @@ -533369,13 +533369,13 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Get a discussion endpoint.

\n
\n

Get a specific discussion on a team's page.

\n

OAuth app tokens and personal access tokens (classic) need the read:discussion scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Get a discussion endpoint.

\n
\n

Get a specific discussion on a team's page.

\n

OAuth app tokens and personal access tokens (classic) need the read:discussion scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -533924,13 +533924,13 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a discussion endpoint.

\n
\n

Delete a discussion from a team's page.

\n

OAuth app tokens and personal access tokens (classic) need the write:discussion scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a discussion endpoint.

\n
\n

Delete a discussion from a team's page.

\n

OAuth app tokens and personal access tokens (classic) need the write:discussion scope to use this endpoint.

" } ], "external-groups": [ @@ -535657,7 +535657,6 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new List team members endpoint.

\n
\n

Team members will include the members of child teams.

", "statusCodes": [ { "httpStatusCode": "200", @@ -535667,7 +535666,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new List team members endpoint.

\n
\n

Team members will include the members of child teams.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -535979,7 +535979,6 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Get team membership for a user endpoint.

\n
\n

Team members will include the members of child teams.

\n

To get a user's membership with a team, the team must be visible to the authenticated user.

\n

Note:\nThe response contains the state of the membership and the member's role.

\n

The role for organization owners is set to maintainer. For more information about maintainer roles, see Create a team.

", "statusCodes": [ { "httpStatusCode": "200", @@ -535989,7 +535988,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Get team membership for a user endpoint.

\n
\n

Team members will include the members of child teams.

\n

To get a user's membership with a team, the team must be visible to the authenticated user.

\n

Note:\nThe response contains the state of the membership and the member's role.

\n

The role for organization owners is set to maintainer. For more information about maintainer roles, see Create a team.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -542814,13 +542814,13 @@ } ], "previews": [], + "descriptionHTML": "

Lists the people who the specified user follows.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ], - "descriptionHTML": "

Lists the people who the specified user follows.

" + ] }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -544921,7 +544921,6 @@ } ], "previews": [], - "descriptionHTML": "

Lists all of your social accounts.

", "statusCodes": [ { "httpStatusCode": "200", @@ -544943,7 +544942,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Lists all of your social accounts.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", diff --git a/src/rest/data/ghes-3.16-2022-11-28/schema.json b/src/rest/data/ghes-3.16-2022-11-28/schema.json index ec988ffdbf05..79199f97e588 100644 --- a/src/rest/data/ghes-3.16-2022-11-28/schema.json +++ b/src/rest/data/ghes-3.16-2022-11-28/schema.json @@ -6066,13 +6066,13 @@ } ], "previews": [], - "descriptionHTML": "

Lists all secrets available in an organization without revealing their\nencrypted values.

\n

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. If the repository is private, the repo scope is also required.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Lists all secrets available in an organization without revealing their\nencrypted values.

\n

Authenticated users must have collaborator access to a repository to create, update, or read secrets.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. If the repository is private, the repo scope is also required.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -13269,13 +13269,13 @@ } ], "previews": [], - "descriptionHTML": "

Adds a self-hosted runner to a runner group configured in an organization.

\n

OAuth tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Adds a self-hosted runner to a runner group configured in an organization.

\n

OAuth tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -27065,13 +27065,13 @@ } ], "previews": [], - "descriptionHTML": "

Deletes a repository variable using the variable name.

\n

Authenticated users must have collaborator access to a repository to create, update, or read variables.

\n

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Deletes a repository variable using the variable name.

\n

Authenticated users must have collaborator access to a repository to create, update, or read variables.

\n

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -82297,13 +82297,13 @@ } ], "previews": [], - "descriptionHTML": "

Marks a thread as \"done.\" Marking a thread as \"done\" is equivalent to marking a notification in your notification inbox on GitHub Enterprise Server as done: https://github.com/notifications.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No content

" } - ] + ], + "descriptionHTML": "

Marks a thread as \"done.\" Marking a thread as \"done\" is equivalent to marking a notification in your notification inbox on GitHub Enterprise Server as done: https://github.com/notifications.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -89941,13 +89941,13 @@ } ], "previews": [], - "descriptionHTML": "

If you would like to watch a repository, set subscribed to true. If you would like to ignore notifications made within a repository, set ignored to true. If you would like to stop watching a repository, delete the repository's subscription completely.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

If you would like to watch a repository, set subscribed to true. If you would like to ignore notifications made within a repository, set ignored to true. If you would like to stop watching a repository, delete the repository's subscription completely.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -92338,13 +92338,13 @@ } ], "previews": [], - "descriptionHTML": "

Removes the announcement banner currently set for the organization.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Removes the announcement banner currently set for the organization.

" } ] }, @@ -101610,13 +101610,13 @@ } ], "previews": [], - "descriptionHTML": "

Enables an authenticated GitHub App to find the organization's installation information.

\n

You must use a JWT to access this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Enables an authenticated GitHub App to find the organization's installation information.

\n

You must use a JWT to access this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -123986,7 +123986,6 @@ } ], "previews": [], - "descriptionHTML": "

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

", "statusCodes": [ { "httpStatusCode": "200", @@ -123996,7 +123995,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -197996,13 +197996,13 @@ } ], "previews": [], - "descriptionHTML": "

Gets your public key, which you need to encrypt secrets. You need to\nencrypt a secret before you can create or update secrets.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Gets your public key, which you need to encrypt secrets. You need to\nencrypt a secret before you can create or update secrets.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -198112,13 +198112,13 @@ } ], "previews": [], - "descriptionHTML": "

Gets a single organization secret without revealing its encrypted value.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Gets a single organization secret without revealing its encrypted value.

\n

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -221644,13 +221644,13 @@ } ], "previews": [], - "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "201", "description": "

Created

" } - ] + ], + "descriptionHTML": "" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -224933,7 +224933,6 @@ } ], "previews": [], - "descriptionHTML": "

Note

\n

\nThe SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

\n
\n

Replaces an existing provisioned group’s information.

\n

You must provide all the information required for the group as if you were provisioning it for the first time. Any existing group information that you don't provide will be removed, including group membership. If you want to only update a specific attribute, use the Update an attribute for a SCIM enterprise group endpoint instead.

", "statusCodes": [ { "httpStatusCode": "200", @@ -224967,7 +224966,8 @@ "httpStatusCode": "500", "description": "

Internal server error

" } - ] + ], + "descriptionHTML": "

Note

\n

\nThe SCIM API endpoints for enterprise accounts are currently in private preview and are subject to change.

\n
\n

Replaces an existing provisioned group’s information.

\n

You must provide all the information required for the group as if you were provisioning it for the first time. Any existing group information that you don't provide will be removed, including group membership. If you want to only update a specific attribute, use the Update an attribute for a SCIM enterprise group endpoint instead.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -329480,7 +329480,6 @@ } ], "previews": [], - "descriptionHTML": "

Each array contains the day number, hour number, and number of commits:

\n
    \n
  • 0-6: Sunday - Saturday
  • \n
  • 0-23: Hour of day
  • \n
  • Number of commits
  • \n
\n

For example, [2, 14, 25] indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits.

", "statusCodes": [ { "httpStatusCode": "200", @@ -329490,7 +329489,8 @@ "httpStatusCode": "204", "description": "

A header with no content is returned.

" } - ] + ], + "descriptionHTML": "

Each array contains the day number, hour number, and number of commits:

\n
    \n
  • 0-6: Sunday - Saturday
  • \n
  • 0-23: Hour of day
  • \n
  • Number of commits
  • \n
\n

For example, [2, 14, 25] indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits.

" } ] }, @@ -338153,7 +338153,6 @@ } ], "previews": [], - "descriptionHTML": "

Initiates the generation of a user migration archive.

", "statusCodes": [ { "httpStatusCode": "201", @@ -338175,7 +338174,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Initiates the generation of a user migration archive.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -373448,13 +373448,13 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nClosing down notice: This operation is closing down and will be removed in Enterprise Server 3.20. Please use the \"Organization Roles\" endpoints instead.

\n
", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nClosing down notice: This operation is closing down and will be removed in Enterprise Server 3.20. Please use the \"Organization Roles\" endpoints instead.

\n
" } ], "webhooks": [ @@ -398974,7 +398974,6 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nClosing down notice: Projects (classic) is being deprecated in favor of the new Projects experience.\nSee the changelog for more information.

\n
", "statusCodes": [ { "httpStatusCode": "200", @@ -398984,7 +398983,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nClosing down notice: Projects (classic) is being deprecated in favor of the new Projects experience.\nSee the changelog for more information.

\n
" } ] }, @@ -419827,7 +419827,6 @@ } ], "previews": [], - "descriptionHTML": "

Checks if a pull request has been merged into the base branch. The HTTP status of the response indicates whether or not the pull request has been merged; the response body is empty.

", "statusCodes": [ { "httpStatusCode": "204", @@ -419837,7 +419836,8 @@ "httpStatusCode": "404", "description": "

Not Found if pull request has not been merged

" } - ] + ], + "descriptionHTML": "

Checks if a pull request has been merged into the base branch. The HTTP status of the response indicates whether or not the pull request has been merged; the response body is empty.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -439114,13 +439114,13 @@ } ], "previews": [], - "descriptionHTML": "

List the reactions to a team discussion comment.

\n

Note

\n

\nYou can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.

\n
\n

OAuth app tokens and personal access tokens (classic) need the read:discussion scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

List the reactions to a team discussion comment.

\n

Note

\n

\nYou can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.

\n
\n

OAuth app tokens and personal access tokens (classic) need the read:discussion scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -443095,13 +443095,13 @@ } ], "previews": [], - "descriptionHTML": "

Note

\n

\nYou can also specify a repository by repository_id using the route DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id.

\n
\n

Delete a reaction to an issue comment.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Note

\n

\nYou can also specify a repository by repository_id using the route DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id.

\n
\n

Delete a reaction to an issue comment.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -448535,7 +448535,6 @@ } ], "previews": [], - "descriptionHTML": "

This returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the Repository Tags API.

\n

Information about published releases are available to everyone. Only users with push access will receive listings for draft releases.

", "statusCodes": [ { "httpStatusCode": "200", @@ -448545,7 +448544,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

This returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the Repository Tags API.

\n

Information about published releases are available to everyone. Only users with push access will receive listings for draft releases.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -480143,7 +480143,6 @@ } ], "previews": [], - "descriptionHTML": "

Lists repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access.

\n

The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.

", "statusCodes": [ { "httpStatusCode": "200", @@ -480165,7 +480164,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Lists repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access.

\n

The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -505619,7 +505619,6 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nClosing down notice: This operation is closing down and will be removed after August 30, 2024. Use the \"Repository Rulesets\" endpoint instead.

\n
\n

This creates a tag protection state for a repository.\nThis endpoint is only available to repository administrators.

", "statusCodes": [ { "httpStatusCode": "201", @@ -505633,7 +505632,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nClosing down notice: This operation is closing down and will be removed after August 30, 2024. Use the \"Repository Rulesets\" endpoint instead.

\n
\n

This creates a tag protection state for a repository.\nThis endpoint is only available to repository administrators.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -520754,7 +520754,6 @@ } ], "previews": [], - "descriptionHTML": "

Gets a single secret scanning alert detected in an eligible repository.

\n

The authenticated user must be an administrator for the repository or for the organization that owns the repository to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead.

", "statusCodes": [ { "httpStatusCode": "200", @@ -520772,7 +520771,8 @@ "httpStatusCode": "503", "description": "

Service unavailable

" } - ] + ], + "descriptionHTML": "

Gets a single secret scanning alert detected in an eligible repository.

\n

The authenticated user must be an administrator for the repository or for the organization that owns the repository to use this endpoint.

\n

OAuth app tokens and personal access tokens (classic) need the repo or security_events scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the public_repo scope instead.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -531680,13 +531680,13 @@ } ], "previews": [], - "descriptionHTML": "

Lists the child teams of the team specified by {team_slug}.

\n

Note

\n

\nYou can also specify a team by org_id and team_id using the route GET /organizations/{org_id}/team/{team_id}/teams.

\n
", "statusCodes": [ { "httpStatusCode": "200", "description": "

if child teams exist

" } - ] + ], + "descriptionHTML": "

Lists the child teams of the team specified by {team_slug}.

\n

Note

\n

\nYou can also specify a team by org_id and team_id using the route GET /organizations/{org_id}/team/{team_id}/teams.

\n
" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -534165,7 +534165,6 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a team endpoint.

\n
\n

To delete a team, the authenticated user must be an organization owner or team maintainer.

\n

If you are an organization owner, deleting a parent team will delete all of its child teams as well.

", "statusCodes": [ { "httpStatusCode": "204", @@ -534179,7 +534178,8 @@ "httpStatusCode": "422", "description": "

Validation failed, or the endpoint has been spammed.

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a team endpoint.

\n
\n

To delete a team, the authenticated user must be an organization owner or team maintainer.

\n

If you are an organization owner, deleting a parent team will delete all of its child teams as well.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -545412,13 +545412,13 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Create a discussion endpoint.

\n
\n

Creates a new discussion post on a team's page.

\n

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see \"Rate limits for the API\" and \"Best practices for using the REST API.\"

\n

OAuth app tokens and personal access tokens (classic) need the write:discussion scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "201", "description": "

Created

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Create a discussion endpoint.

\n
\n

Creates a new discussion post on a team's page.

\n

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. For more information, see \"Rate limits for the API\" and \"Best practices for using the REST API.\"

\n

OAuth app tokens and personal access tokens (classic) need the write:discussion scope to use this endpoint.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -546441,13 +546441,13 @@ } ], "previews": [], - "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a discussion endpoint.

\n
\n

Delete a discussion from a team's page.

\n

OAuth app tokens and personal access tokens (classic) need the write:discussion scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "204", "description": "

No Content

" } - ] + ], + "descriptionHTML": "

Warning

\n

\nEndpoint closing down notice: This endpoint route is closing down and will be removed from the Teams API. We recommend migrating your existing code to use the new Delete a discussion endpoint.

\n
\n

Delete a discussion from a team's page.

\n

OAuth app tokens and personal access tokens (classic) need the write:discussion scope to use this endpoint.

" } ], "external-groups": [ @@ -554039,7 +554039,6 @@ } ], "previews": [], - "descriptionHTML": "

Lists your publicly visible email address, which you can set with the\nSet primary email visibility for the authenticated user\nendpoint.

\n

OAuth app tokens and personal access tokens (classic) need the user:email scope to use this endpoint.

", "statusCodes": [ { "httpStatusCode": "200", @@ -554061,7 +554060,8 @@ "httpStatusCode": "404", "description": "

Resource not found

" } - ] + ], + "descriptionHTML": "

Lists your publicly visible email address, which you can set with the\nSet primary email visibility for the authenticated user\nendpoint.

\n

OAuth app tokens and personal access tokens (classic) need the user:email scope to use this endpoint.

" } ], "followers": [ @@ -554643,7 +554643,6 @@ } ], "previews": [], - "descriptionHTML": "", "statusCodes": [ { "httpStatusCode": "204", @@ -554665,7 +554664,8 @@ "httpStatusCode": "404", "description": "

if the person is not followed by the authenticated user

" } - ] + ], + "descriptionHTML": "" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", @@ -555331,13 +555331,13 @@ } ], "previews": [], - "descriptionHTML": "

Lists the people who the specified user follows.

", "statusCodes": [ { "httpStatusCode": "200", "description": "

OK

" } - ] + ], + "descriptionHTML": "

Lists the people who the specified user follows.

" }, { "serverUrl": "http(s)://HOSTNAME/api/v3", diff --git a/src/rest/scripts/utils/get-openapi-schemas.js b/src/rest/scripts/utils/get-openapi-schemas.ts similarity index 83% rename from src/rest/scripts/utils/get-openapi-schemas.js rename to src/rest/scripts/utils/get-openapi-schemas.ts index eab4b23ec725..58cebfc6660a 100644 --- a/src/rest/scripts/utils/get-openapi-schemas.js +++ b/src/rest/scripts/utils/get-openapi-schemas.ts @@ -5,17 +5,21 @@ import path from 'path' import { allVersions } from '@/versions/lib/all-versions' const OPEN_API_RELEASES_DIR = '../github/app/api/description/config/releases' -const configData = JSON.parse(await readFile('src/rest/lib/config.json', 'utf8')) +const configData: { versionMapping: Record } = JSON.parse( + await readFile('src/rest/lib/config.json', 'utf8'), +) // Gets the full list of unpublished + active, deprecated + active, // or active schemas from the github/github repo // `openApiReleaseDir` is the path to the `app/api/description/config/releases` // directory in `github/github` // You can also specify getting specific versions of schemas. -export async function getSchemas(directory = OPEN_API_RELEASES_DIR) { +export async function getSchemas( + directory: string = OPEN_API_RELEASES_DIR, +): Promise<{ currentReleases: string[]; unpublished: string[]; deprecated: string[] }> { const openAPIConfigs = await readdir(directory) - const unpublished = [] - const deprecated = [] - const currentReleases = [] + const unpublished: string[] = [] + const deprecated: string[] = [] + const currentReleases: string[] = [] // The file content in the `github/github` repo is YAML before it is // bundled into JSON. @@ -23,7 +27,7 @@ export async function getSchemas(directory = OPEN_API_RELEASES_DIR) { const fileBaseName = path.basename(file, '.yaml') const newFileName = `${fileBaseName}.deref.json` const content = await readFile(path.join(directory, file), 'utf8') - const yamlContent = yaml.load(content) + const yamlContent = yaml.load(content) as { published?: boolean; deprecated?: boolean } const releaseMatch = Object.keys(configData.versionMapping).find((name) => fileBaseName.startsWith(name), @@ -62,7 +66,7 @@ export async function getSchemas(directory = OPEN_API_RELEASES_DIR) { return { currentReleases, unpublished, deprecated } } -export async function validateVersionsOptions(versions) { +export async function validateVersionsOptions(versions: string[]): Promise { const schemas = await getSchemas() // Validate individual versions provided versions.forEach((version) => { diff --git a/src/versions/tests/ghes-versioning.js b/src/versions/tests/ghes-versioning.ts similarity index 80% rename from src/versions/tests/ghes-versioning.js rename to src/versions/tests/ghes-versioning.ts index 5ffacb9d63c5..3ca725a7f433 100644 --- a/src/versions/tests/ghes-versioning.js +++ b/src/versions/tests/ghes-versioning.ts @@ -4,14 +4,17 @@ import { allVersions } from '@/versions/lib/all-versions' import { liquid } from '@/content-render/index' import { supported } from '@/versions/lib/enterprise-server-releases' import shortVersionsMiddleware from '@/versions/middleware/short-versions' +import type { ExtendedRequest } from '@/types' -const contextualize = (req) => { - req.context.currentVersionObj = req.context.allVersions[req.context.currentVersion] +const contextualize = (req: ExtendedRequest): void => { + if (!req.context) throw new Error('No context on request') + if (!req.context.currentVersion) throw new Error('No currentVersion in context') + req.context.currentVersionObj = req.context.allVersions?.[req.context.currentVersion] shortVersionsMiddleware(req, null, () => {}) } describe('ifversion conditionals', () => { - const req = {} + const req: ExtendedRequest = {} as ExtendedRequest beforeAll(async () => { req.context = { allVersions,