diff --git a/assets/images/help/copilot/mcp-icon-in-dropdown.png b/assets/images/help/copilot/mcp-icon-in-dropdown.png new file mode 100644 index 000000000000..431cdc82d384 Binary files /dev/null and b/assets/images/help/copilot/mcp-icon-in-dropdown.png differ diff --git a/content/copilot/concepts/context/mcp.md b/content/copilot/concepts/context/mcp.md index 0a865051db82..d6dc84e2090a 100644 --- a/content/copilot/concepts/context/mcp.md +++ b/content/copilot/concepts/context/mcp.md @@ -45,6 +45,13 @@ Running the {% data variables.product.github %} MCP server locally requires a bi To learn how to set up and use the {% data variables.product.github %} MCP server, see [AUTOTITLE](/copilot/how-tos/context/model-context-protocol/using-the-github-mcp-server). +## About the {% data variables.product.github %} MCP Registry + +The {% data variables.product.github %} MCP Registry is a curated list of MCP servers from partners and the community. You can use the registry to discover new MCP servers and find ones that meet your specific needs. See [the {% data variables.product.github %} MCP Registry](https://github.com/mcp). + +>[!NOTE] +> The {% data variables.product.github %} MCP Registry is currently in {% data variables.release-phases.public_preview %} and subject to change. + ## Availability There is currently broad support for local MCP servers in clients such as {% data variables.product.prodname_vscode %}, JetBrains IDEs, XCode, and others. diff --git a/content/copilot/how-tos/provide-context/use-mcp/extend-copilot-chat-with-mcp.md b/content/copilot/how-tos/provide-context/use-mcp/extend-copilot-chat-with-mcp.md index e26defea2a09..e717567b9db8 100644 --- a/content/copilot/how-tos/provide-context/use-mcp/extend-copilot-chat-with-mcp.md +++ b/content/copilot/how-tos/provide-context/use-mcp/extend-copilot-chat-with-mcp.md @@ -35,6 +35,25 @@ For information on currently available MCP servers, see [the MCP servers reposit ## Configuring MCP servers in {% data variables.product.prodname_vscode %} +MCP servers can be configured manually in a configuration file, or through the {% data variables.product.github %} MCP Registry. The {% data variables.product.github %} MCP Registry provides a curated list of MCP servers that you can easily add to your {% data variables.product.prodname_vscode %} instance. + +### Using the {% data variables.product.github %} MCP Registry + +>[!NOTE] +> The {% data variables.product.github %} MCP Registry is in {% data variables.release-phases.public_preview %} and may change. + +Only MCP servers listed in the {% data variables.product.github %} MCP Registry can be added through the registry. Other servers can be configured manually. See [Configuring MCP servers manually](#configuring-mcp-servers-manually). + +1. Visit the [{% data variables.product.github %} MCP Registry](https://github.com/mcp). +1. In the search bar, search for the MCP server you want to add, then click the MCP server in the list of matches. +1. On the MCP server page, read the description for details on installation requirements and other important usage information. This may vary between servers. +1. Click **Install server**, then select **Install in {% data variables.product.prodname_vscode_shortname %}**. +1. {% data variables.product.prodname_vscode %} will open, on the server's Marketplace page. Click **Install** to add the MCP server to your {% data variables.product.prodname_vscode %} instance. +1. If further configuration is required, follow the instructions on the MCP server page in the {% data variables.product.github %} MCP Registry. +1. To check that the MCP server has been added, in the **agent mode** of {% data variables.copilot.copilot_chat_short %}, click the tools icon. A dropdown list will appear, showing all the MCP servers and associated tools that are currently available in your {% data variables.product.prodname_vscode %} instance. + +### Configuring MCP servers manually + To configure MCP servers in {% data variables.product.prodname_vscode %}, you need to set up a configuration script that specifies the details of the MCP servers you want to use. You can configure MCP servers for either: {% data reusables.copilot.mcp.mcp-configuration-location %} diff --git a/data/reusables/profile/copilot_settings.md b/data/reusables/profile/copilot_settings.md new file mode 100644 index 000000000000..49d581592a9c --- /dev/null +++ b/data/reusables/profile/copilot_settings.md @@ -0,0 +1 @@ +1. In the top right corner of {% data variables.product.prodname_dotcom %}, click your profile picture, then click **{% octicon "copilot" aria-hidden="true" aria-label="copilot" %} {% data variables.product.prodname_copilot_short %} settings**. diff --git a/src/content-linter/lib/default-markdownlint-options.js b/src/content-linter/lib/default-markdownlint-options.js deleted file mode 100644 index ccdda0329a94..000000000000 --- a/src/content-linter/lib/default-markdownlint-options.js +++ /dev/null @@ -1,3 +0,0 @@ -export const defaultConfig = { - default: false, -} diff --git a/src/content-linter/lib/default-markdownlint-options.ts b/src/content-linter/lib/default-markdownlint-options.ts new file mode 100644 index 000000000000..d21f286179b2 --- /dev/null +++ b/src/content-linter/lib/default-markdownlint-options.ts @@ -0,0 +1,5 @@ +import type { Configuration } from 'markdownlint' + +export const defaultConfig: Configuration = { + default: false, +} diff --git a/src/content-linter/lib/helpers/get-rules.d.ts b/src/content-linter/lib/helpers/get-rules.d.ts deleted file mode 100644 index 694e3ec21464..000000000000 --- a/src/content-linter/lib/helpers/get-rules.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// get-rules.d.ts -// This is a declaration file for get-rules.js - -import type { Rule, RuleConfig } from '../../types' - -export const customRules: Rule[] -export const allRules: Rule[] -export const allConfig: RuleConfig diff --git a/src/content-linter/lib/helpers/get-rules.js b/src/content-linter/lib/helpers/get-rules.js deleted file mode 100644 index efa98024f5ad..000000000000 --- a/src/content-linter/lib/helpers/get-rules.js +++ /dev/null @@ -1,8 +0,0 @@ -import rules from '../../../../node_modules/markdownlint/lib/rules' -import { gitHubDocsMarkdownlint } from '../linting-rules/index' -import { baseConfig } from '../../style/base' -import { customConfig } from '../../style/github-docs' - -export const customRules = gitHubDocsMarkdownlint.rules -export const allRules = [...rules, ...gitHubDocsMarkdownlint.rules] -export const allConfig = { ...baseConfig, ...customConfig } diff --git a/src/content-linter/lib/helpers/get-rules.ts b/src/content-linter/lib/helpers/get-rules.ts new file mode 100644 index 000000000000..eaeaf8660aa9 --- /dev/null +++ b/src/content-linter/lib/helpers/get-rules.ts @@ -0,0 +1,12 @@ +import { gitHubDocsMarkdownlint } from '@/content-linter/lib/linting-rules/index' +import { baseConfig } from '@/content-linter/style/base' +import { customConfig } from '@/content-linter/style/github-docs' +import type { Rule } from '@/content-linter/types' + +// Import markdownlint rules - external library without TypeScript declarations +// @ts-ignore - markdownlint doesn't provide TypeScript declarations +import markdownlintRules from '../../../../node_modules/markdownlint/lib/rules' + +export const customRules: Rule[] = gitHubDocsMarkdownlint.rules +export const allRules: any[] = [...markdownlintRules, ...gitHubDocsMarkdownlint.rules] +export const allConfig: Record = { ...baseConfig, ...customConfig } diff --git a/src/content-linter/lib/helpers/unified-formatter-options.js b/src/content-linter/lib/helpers/unified-formatter-options.js deleted file mode 100644 index d5efae175118..000000000000 --- a/src/content-linter/lib/helpers/unified-formatter-options.js +++ /dev/null @@ -1,9 +0,0 @@ -export const MARKDOWN_OPTIONS = { - bullet: '*', - emphasis: '_', - closeAtx: false, - fence: '`', - fences: true, - incrementListMarker: false, - strong: '*', -} diff --git a/src/content-linter/lib/helpers/unified-formatter-options.ts b/src/content-linter/lib/helpers/unified-formatter-options.ts new file mode 100644 index 000000000000..a4d20e8daa6e --- /dev/null +++ b/src/content-linter/lib/helpers/unified-formatter-options.ts @@ -0,0 +1,19 @@ +interface MarkdownFormatterOptions { + bullet: string + emphasis: string + closeAtx: boolean + fence: string + fences: boolean + incrementListMarker: boolean + strong: string +} + +export const MARKDOWN_OPTIONS: MarkdownFormatterOptions = { + bullet: '*', + emphasis: '_', + closeAtx: false, + fence: '`', + fences: true, + incrementListMarker: false, + strong: '*', +} diff --git a/src/content-render/liquid/error-handling.js b/src/content-render/liquid/error-handling.ts similarity index 70% rename from src/content-render/liquid/error-handling.js rename to src/content-render/liquid/error-handling.ts index d131cb7dd5ef..c37e1a4b2ec2 100644 --- a/src/content-render/liquid/error-handling.js +++ b/src/content-render/liquid/error-handling.ts @@ -1,9 +1,9 @@ // If 'THROW_ON_EMPTY' is set and it's value is '0' or 'false' it becomes // false. Or true if it's 'true' or '1'. -export const THROW_ON_EMPTY = Boolean( +export const THROW_ON_EMPTY: boolean = Boolean( process.env.THROW_ON_EMPTY ? JSON.parse(process.env.THROW_ON_EMPTY) - : JSON.parse(process.env.CI || process.env.NODE_ENV !== 'production'), + : JSON.parse(String(process.env.CI || process.env.NODE_ENV !== 'production')), ) export class DataReferenceError extends Error {} diff --git a/src/content-render/liquid/ifversion-supported-operators.js b/src/content-render/liquid/ifversion-supported-operators.js deleted file mode 100644 index 03234759e50e..000000000000 --- a/src/content-render/liquid/ifversion-supported-operators.js +++ /dev/null @@ -1 +0,0 @@ -export default ['=', '<', '>', '!='] diff --git a/src/content-render/liquid/ifversion-supported-operators.ts b/src/content-render/liquid/ifversion-supported-operators.ts new file mode 100644 index 000000000000..735c32f40c41 --- /dev/null +++ b/src/content-render/liquid/ifversion-supported-operators.ts @@ -0,0 +1,5 @@ +const ifversionSupportedOperators = ['=', '<', '>', '!='] as const + +export type IfversionSupportedOperator = (typeof ifversionSupportedOperators)[number] + +export default ifversionSupportedOperators diff --git a/src/content-render/liquid/index.js b/src/content-render/liquid/index.ts similarity index 69% rename from src/content-render/liquid/index.js rename to src/content-render/liquid/index.ts index 412d11b75c23..ec46b21a7d2a 100644 --- a/src/content-render/liquid/index.js +++ b/src/content-render/liquid/index.ts @@ -1,7 +1,7 @@ import { processLiquidPost } from './post' import { engine } from './engine' -export async function renderLiquid(template, context) { +export async function renderLiquid(template: string, context: any): Promise { template = await engine.parseAndRender(template, context) template = processLiquidPost(template) return template diff --git a/src/data-directory/lib/data-schemas/code-languages.js b/src/data-directory/lib/data-schemas/code-languages.js deleted file mode 100644 index e3c89a434f91..000000000000 --- a/src/data-directory/lib/data-schemas/code-languages.js +++ /dev/null @@ -1,16 +0,0 @@ -export default { - type: 'object', - additionalProperties: { - type: 'object', - required: ['name', 'comment'], - properties: { - name: { - type: 'string', - }, - comment: { - type: 'string', - enum: ['number', 'slash', 'percent', 'hyphen', 'xml', 'none'], - }, - }, - }, -} diff --git a/src/data-directory/lib/data-schemas/code-languages.ts b/src/data-directory/lib/data-schemas/code-languages.ts new file mode 100644 index 000000000000..aa7f48e996e6 --- /dev/null +++ b/src/data-directory/lib/data-schemas/code-languages.ts @@ -0,0 +1,37 @@ +interface CodeLanguageProperties { + name: { + type: 'string' + } + comment: { + type: 'string' + enum: ['number', 'slash', 'percent', 'hyphen', 'xml', 'none'] + } +} + +interface CodeLanguageSchema { + type: 'object' + additionalProperties: { + type: 'object' + required: ['name', 'comment'] + properties: CodeLanguageProperties + } +} + +const codeLanguagesSchema: CodeLanguageSchema = { + type: 'object', + additionalProperties: { + type: 'object', + required: ['name', 'comment'], + properties: { + name: { + type: 'string', + }, + comment: { + type: 'string', + enum: ['number', 'slash', 'percent', 'hyphen', 'xml', 'none'], + }, + }, + }, +} + +export default codeLanguagesSchema diff --git a/src/data-directory/lib/data-schemas/index.ts b/src/data-directory/lib/data-schemas/index.ts index e8d58ceb5ed4..160483e39d6d 100644 --- a/src/data-directory/lib/data-schemas/index.ts +++ b/src/data-directory/lib/data-schemas/index.ts @@ -4,10 +4,10 @@ interface DataSchemas { const dataSchemas: DataSchemas = { 'data/features': '@/data-directory/lib/data-schemas/features.js', - 'data/variables': '@/data-directory/lib/data-schemas/variables.js', + 'data/variables': '@/data-directory/lib/data-schemas/variables', 'data/learning-tracks': '@/data-directory/lib/data-schemas/learning-tracks.js', 'data/release-notes': '@/data-directory/lib/data-schemas/release-notes.js', - 'data/code-languages.yml': '@/data-directory/lib/data-schemas/code-languages.js', + 'data/code-languages.yml': '@/data-directory/lib/data-schemas/code-languages', 'data/glossaries/candidates.yml': '@/data-directory/lib/data-schemas/glossaries-candidates.js', 'data/glossaries/external.yml': '@/data-directory/lib/data-schemas/glossaries-external.js', } diff --git a/src/data-directory/lib/data-schemas/variables.js b/src/data-directory/lib/data-schemas/variables.js deleted file mode 100644 index 3cec2cc6ff4a..000000000000 --- a/src/data-directory/lib/data-schemas/variables.js +++ /dev/null @@ -1,7 +0,0 @@ -export default { - type: 'object', - additionalProperties: { - type: 'string', - lintable: true, - }, -} diff --git a/src/data-directory/lib/data-schemas/variables.ts b/src/data-directory/lib/data-schemas/variables.ts new file mode 100644 index 000000000000..62ba9e1937cd --- /dev/null +++ b/src/data-directory/lib/data-schemas/variables.ts @@ -0,0 +1,17 @@ +interface VariableSchema { + type: 'object' + additionalProperties: { + type: 'string' + lintable: boolean + } +} + +const variablesSchema: VariableSchema = { + type: 'object', + additionalProperties: { + type: 'string', + lintable: true, + }, +} + +export default variablesSchema diff --git a/src/frame/lib/encode-bracketed-parentheses.js b/src/frame/lib/encode-bracketed-parentheses.ts similarity index 69% rename from src/frame/lib/encode-bracketed-parentheses.js rename to src/frame/lib/encode-bracketed-parentheses.ts index e3e4b3040375..d0df9a4a12ae 100644 --- a/src/frame/lib/encode-bracketed-parentheses.js +++ b/src/frame/lib/encode-bracketed-parentheses.ts @@ -1,6 +1,6 @@ // prevent `[foo] (bar)` strings with a space between from being interpreted as markdown links // by encoding the space character -export default function encodeBracketedParentheses(input) { +export default function encodeBracketedParentheses(input: string): string { return input.replace(/] \(/g, '] (') } diff --git a/src/frame/lib/read-file-contents.js b/src/frame/lib/read-file-contents.ts similarity index 55% rename from src/frame/lib/read-file-contents.js rename to src/frame/lib/read-file-contents.ts index 9b3aefc698c0..299efed569a7 100644 --- a/src/frame/lib/read-file-contents.js +++ b/src/frame/lib/read-file-contents.ts @@ -6,8 +6,9 @@ import fm from './frontmatter' /** * Read only the frontmatter from file */ -export default async function fmfromf(filepath) { - let fileContent = await fs.readFile(filepath, 'utf8') +// Using any type for return value because frontmatter structure is complex and varies +export default async function fmfromf(filepath: string): Promise { + let fileContent: string = await fs.readFile(filepath, 'utf8') fileContent = encodeBracketedParentheses(fileContent) diff --git a/src/frame/tests/gitignore.js b/src/frame/tests/gitignore.ts similarity index 57% rename from src/frame/tests/gitignore.js rename to src/frame/tests/gitignore.ts index 989f42e63ac8..760ac36341a7 100644 --- a/src/frame/tests/gitignore.js +++ b/src/frame/tests/gitignore.ts @@ -3,9 +3,9 @@ import path from 'path' import { describe, expect, test } from 'vitest' -const gitignorePath = path.join(process.cwd(), '.gitignore') -const gitignore = await fs.readFile(gitignorePath, 'utf8') -const entries = gitignore.split(/\r?\n/) +const gitignorePath: string = path.join(process.cwd(), '.gitignore') +const gitignore: string = await fs.readFile(gitignorePath, 'utf8') +const entries: string[] = gitignore.split(/\r?\n/) describe('.gitignore file', () => { test('includes an entry for .env', () => { diff --git a/src/graphql/data/fpt/changelog.json b/src/graphql/data/fpt/changelog.json index bd6ce479bfd7..8dbc38772e7c 100644 --- a/src/graphql/data/fpt/changelog.json +++ b/src/graphql/data/fpt/changelog.json @@ -1,4 +1,21 @@ [ + { + "schemaChanges": [ + { + "title": "The GraphQL schema includes these changes:", + "changes": [ + "

Type CopilotCodeReviewParameters was added

", + "

Type CopilotCodeReviewParametersInput was added

", + "

Enum value 'COPILOT_CODE_REVIEWwas added to enumRepositoryRuleType'

", + "

Member CopilotCodeReviewParameters was added to Union type RuleParameters

", + "

Input field copilotCodeReview of type CopilotCodeReviewParametersInput was added to input object type RuleParametersInput

" + ] + } + ], + "previewChanges": [], + "upcomingChanges": [], + "date": "2025-09-16" + }, { "schemaChanges": [ { diff --git a/src/graphql/data/fpt/schema.docs.graphql b/src/graphql/data/fpt/schema.docs.graphql index f44cad4cede4..b4737f6059fc 100644 --- a/src/graphql/data/fpt/schema.docs.graphql +++ b/src/graphql/data/fpt/schema.docs.graphql @@ -7250,6 +7250,36 @@ type ConvertedToDiscussionEvent implements Node { id: ID! } +""" +Request Copilot code review for new pull requests automatically if the author has access to Copilot code review. +""" +type CopilotCodeReviewParameters { + """ + Copilot automatically reviews draft pull requests before they are marked as ready for review. + """ + reviewDraftPullRequests: Boolean! + + """ + Copilot automatically reviews each new push to the pull request. + """ + reviewOnPush: Boolean! +} + +""" +Request Copilot code review for new pull requests automatically if the author has access to Copilot code review. +""" +input CopilotCodeReviewParametersInput { + """ + Copilot automatically reviews draft pull requests before they are marked as ready for review. + """ + reviewDraftPullRequests: Boolean + + """ + Copilot automatically reviews each new push to the pull request. + """ + reviewOnPush: Boolean +} + """ Copilot endpoint information """ @@ -52909,6 +52939,11 @@ enum RepositoryRuleType { """ COMMIT_MESSAGE_PATTERN + """ + Request Copilot code review for new pull requests automatically if the author has access to Copilot code review. + """ + COPILOT_CODE_REVIEW + """ Only allow users with bypass permission to create matching refs. """ @@ -54874,6 +54909,7 @@ union RuleParameters = | CommitAuthorEmailPatternParameters | CommitMessagePatternParameters | CommitterEmailPatternParameters + | CopilotCodeReviewParameters | FileExtensionRestrictionParameters | FilePathRestrictionParameters | MaxFilePathLengthParameters @@ -54915,6 +54951,11 @@ input RuleParametersInput { """ committerEmailPattern: CommitterEmailPatternParametersInput + """ + Parameters used for the `copilot_code_review` rule type + """ + copilotCodeReview: CopilotCodeReviewParametersInput + """ Parameters used for the `file_extension_restriction` rule type """ diff --git a/src/graphql/data/fpt/schema.json b/src/graphql/data/fpt/schema.json index b0ea2c548730..d2a5402ed2c7 100644 --- a/src/graphql/data/fpt/schema.json +++ b/src/graphql/data/fpt/schema.json @@ -17432,6 +17432,31 @@ } ] }, + { + "name": "CopilotCodeReviewParameters", + "kind": "objects", + "id": "copilotcodereviewparameters", + "href": "/graphql/reference/objects#copilotcodereviewparameters", + "description": "

Request Copilot code review for new pull requests automatically if the author has access to Copilot code review.

", + "fields": [ + { + "name": "reviewDraftPullRequests", + "description": "

Copilot automatically reviews draft pull requests before they are marked as ready for review.

", + "type": "Boolean!", + "id": "boolean", + "kind": "scalars", + "href": "/graphql/reference/scalars#boolean" + }, + { + "name": "reviewOnPush", + "description": "

Copilot automatically reviews each new push to the pull request.

", + "type": "Boolean!", + "id": "boolean", + "kind": "scalars", + "href": "/graphql/reference/scalars#boolean" + } + ] + }, { "name": "CopilotEndpoints", "kind": "objects", @@ -92881,6 +92906,10 @@ "name": "COMMIT_MESSAGE_PATTERN", "description": "

Commit message pattern.

" }, + { + "name": "COPILOT_CODE_REVIEW", + "description": "

Request Copilot code review for new pull requests automatically if the author has access to Copilot code review.

" + }, { "name": "CREATION", "description": "

Only allow users with bypass permission to create matching refs.

" @@ -97143,6 +97172,11 @@ "id": "committeremailpatternparameters", "href": "/graphql/reference/objects#committeremailpatternparameters" }, + { + "name": "CopilotCodeReviewParameters", + "id": "copilotcodereviewparameters", + "href": "/graphql/reference/objects#copilotcodereviewparameters" + }, { "name": "FileExtensionRestrictionParameters", "id": "fileextensionrestrictionparameters", @@ -99886,6 +99920,31 @@ } ] }, + { + "name": "CopilotCodeReviewParametersInput", + "kind": "inputObjects", + "id": "copilotcodereviewparametersinput", + "href": "/graphql/reference/input-objects#copilotcodereviewparametersinput", + "description": "

Request Copilot code review for new pull requests automatically if the author has access to Copilot code review.

", + "inputFields": [ + { + "name": "reviewDraftPullRequests", + "description": "

Copilot automatically reviews draft pull requests before they are marked as ready for review.

", + "type": "Boolean", + "id": "boolean", + "kind": "scalars", + "href": "/graphql/reference/scalars#boolean" + }, + { + "name": "reviewOnPush", + "description": "

Copilot automatically reviews each new push to the pull request.

", + "type": "Boolean", + "id": "boolean", + "kind": "scalars", + "href": "/graphql/reference/scalars#boolean" + } + ] + }, { "name": "CopyProjectV2Input", "kind": "inputObjects", @@ -107134,6 +107193,14 @@ "kind": "input-objects", "href": "/graphql/reference/input-objects#committeremailpatternparametersinput" }, + { + "name": "copilotCodeReview", + "description": "

Parameters used for the copilot_code_review rule type.

", + "type": "CopilotCodeReviewParametersInput", + "id": "copilotcodereviewparametersinput", + "kind": "input-objects", + "href": "/graphql/reference/input-objects#copilotcodereviewparametersinput" + }, { "name": "fileExtensionRestriction", "description": "

Parameters used for the file_extension_restriction rule type.

", diff --git a/src/graphql/data/ghec/schema.docs.graphql b/src/graphql/data/ghec/schema.docs.graphql index f44cad4cede4..b4737f6059fc 100644 --- a/src/graphql/data/ghec/schema.docs.graphql +++ b/src/graphql/data/ghec/schema.docs.graphql @@ -7250,6 +7250,36 @@ type ConvertedToDiscussionEvent implements Node { id: ID! } +""" +Request Copilot code review for new pull requests automatically if the author has access to Copilot code review. +""" +type CopilotCodeReviewParameters { + """ + Copilot automatically reviews draft pull requests before they are marked as ready for review. + """ + reviewDraftPullRequests: Boolean! + + """ + Copilot automatically reviews each new push to the pull request. + """ + reviewOnPush: Boolean! +} + +""" +Request Copilot code review for new pull requests automatically if the author has access to Copilot code review. +""" +input CopilotCodeReviewParametersInput { + """ + Copilot automatically reviews draft pull requests before they are marked as ready for review. + """ + reviewDraftPullRequests: Boolean + + """ + Copilot automatically reviews each new push to the pull request. + """ + reviewOnPush: Boolean +} + """ Copilot endpoint information """ @@ -52909,6 +52939,11 @@ enum RepositoryRuleType { """ COMMIT_MESSAGE_PATTERN + """ + Request Copilot code review for new pull requests automatically if the author has access to Copilot code review. + """ + COPILOT_CODE_REVIEW + """ Only allow users with bypass permission to create matching refs. """ @@ -54874,6 +54909,7 @@ union RuleParameters = | CommitAuthorEmailPatternParameters | CommitMessagePatternParameters | CommitterEmailPatternParameters + | CopilotCodeReviewParameters | FileExtensionRestrictionParameters | FilePathRestrictionParameters | MaxFilePathLengthParameters @@ -54915,6 +54951,11 @@ input RuleParametersInput { """ committerEmailPattern: CommitterEmailPatternParametersInput + """ + Parameters used for the `copilot_code_review` rule type + """ + copilotCodeReview: CopilotCodeReviewParametersInput + """ Parameters used for the `file_extension_restriction` rule type """ diff --git a/src/graphql/data/ghec/schema.json b/src/graphql/data/ghec/schema.json index b0ea2c548730..d2a5402ed2c7 100644 --- a/src/graphql/data/ghec/schema.json +++ b/src/graphql/data/ghec/schema.json @@ -17432,6 +17432,31 @@ } ] }, + { + "name": "CopilotCodeReviewParameters", + "kind": "objects", + "id": "copilotcodereviewparameters", + "href": "/graphql/reference/objects#copilotcodereviewparameters", + "description": "

Request Copilot code review for new pull requests automatically if the author has access to Copilot code review.

", + "fields": [ + { + "name": "reviewDraftPullRequests", + "description": "

Copilot automatically reviews draft pull requests before they are marked as ready for review.

", + "type": "Boolean!", + "id": "boolean", + "kind": "scalars", + "href": "/graphql/reference/scalars#boolean" + }, + { + "name": "reviewOnPush", + "description": "

Copilot automatically reviews each new push to the pull request.

", + "type": "Boolean!", + "id": "boolean", + "kind": "scalars", + "href": "/graphql/reference/scalars#boolean" + } + ] + }, { "name": "CopilotEndpoints", "kind": "objects", @@ -92881,6 +92906,10 @@ "name": "COMMIT_MESSAGE_PATTERN", "description": "

Commit message pattern.

" }, + { + "name": "COPILOT_CODE_REVIEW", + "description": "

Request Copilot code review for new pull requests automatically if the author has access to Copilot code review.

" + }, { "name": "CREATION", "description": "

Only allow users with bypass permission to create matching refs.

" @@ -97143,6 +97172,11 @@ "id": "committeremailpatternparameters", "href": "/graphql/reference/objects#committeremailpatternparameters" }, + { + "name": "CopilotCodeReviewParameters", + "id": "copilotcodereviewparameters", + "href": "/graphql/reference/objects#copilotcodereviewparameters" + }, { "name": "FileExtensionRestrictionParameters", "id": "fileextensionrestrictionparameters", @@ -99886,6 +99920,31 @@ } ] }, + { + "name": "CopilotCodeReviewParametersInput", + "kind": "inputObjects", + "id": "copilotcodereviewparametersinput", + "href": "/graphql/reference/input-objects#copilotcodereviewparametersinput", + "description": "

Request Copilot code review for new pull requests automatically if the author has access to Copilot code review.

", + "inputFields": [ + { + "name": "reviewDraftPullRequests", + "description": "

Copilot automatically reviews draft pull requests before they are marked as ready for review.

", + "type": "Boolean", + "id": "boolean", + "kind": "scalars", + "href": "/graphql/reference/scalars#boolean" + }, + { + "name": "reviewOnPush", + "description": "

Copilot automatically reviews each new push to the pull request.

", + "type": "Boolean", + "id": "boolean", + "kind": "scalars", + "href": "/graphql/reference/scalars#boolean" + } + ] + }, { "name": "CopyProjectV2Input", "kind": "inputObjects", @@ -107134,6 +107193,14 @@ "kind": "input-objects", "href": "/graphql/reference/input-objects#committeremailpatternparametersinput" }, + { + "name": "copilotCodeReview", + "description": "

Parameters used for the copilot_code_review rule type.

", + "type": "CopilotCodeReviewParametersInput", + "id": "copilotcodereviewparametersinput", + "kind": "input-objects", + "href": "/graphql/reference/input-objects#copilotcodereviewparametersinput" + }, { "name": "fileExtensionRestriction", "description": "

Parameters used for the file_extension_restriction rule type.

", diff --git a/src/rest/pages/category.tsx b/src/rest/pages/category.tsx index e14eaf70fcd2..0a7f1d5701d2 100644 --- a/src/rest/pages/category.tsx +++ b/src/rest/pages/category.tsx @@ -62,7 +62,7 @@ export default function Category({ export const getServerSideProps: GetServerSideProps = async (context) => { const { default: getRest, getRestMiniTocItems } = await import('@/rest/lib/index') const nonEnterpriseDefaultVersionModule = await import( - 'src/versions/lib/non-enterprise-default-version.js' + '@/versions/lib/non-enterprise-default-version' ) const nonEnterpriseDefaultVersion = nonEnterpriseDefaultVersionModule.default as string diff --git a/src/tests/helpers/script-data.js b/src/tests/helpers/script-data.js deleted file mode 100644 index b7bc3f0070ad..000000000000 --- a/src/tests/helpers/script-data.js +++ /dev/null @@ -1,13 +0,0 @@ -const NEXT_DATA_QUERY = 'script#__NEXT_DATA__' -const PRIMER_DATA_QUERY = 'script#__PRIMER_DATA__' - -function getScriptData($, key) { - const data = $(key) - if (!data.length === 1) { - throw new Error(`Not exactly 1 element match for '${key}'. Found ${data.length}`) - } - return JSON.parse(data.get()[0].children[0].data) -} - -export const getNextData = ($) => getScriptData($, NEXT_DATA_QUERY) -export const getPrimerData = ($) => getScriptData($, PRIMER_DATA_QUERY) diff --git a/src/tests/helpers/script-data.ts b/src/tests/helpers/script-data.ts new file mode 100644 index 000000000000..ec028b852382 --- /dev/null +++ b/src/tests/helpers/script-data.ts @@ -0,0 +1,15 @@ +const NEXT_DATA_QUERY = 'script#__NEXT_DATA__' +const PRIMER_DATA_QUERY = 'script#__PRIMER_DATA__' + +// Using any type for $ parameter as it represents a jQuery-like selector (cheerio) +function getScriptData($: any, key: string): any { + const data = $(key) + if (data.length !== 1) { + throw new Error(`Not exactly 1 element match for '${key}'. Found ${data.length}`) + } + return JSON.parse(data.get()[0].children[0].data) +} + +// Using any types for cheerio/jQuery-like objects and parsed JSON data +export const getNextData = ($: any): any => getScriptData($, NEXT_DATA_QUERY) +export const getPrimerData = ($: any): any => getScriptData($, PRIMER_DATA_QUERY) diff --git a/src/types/markdownlint-rules.d.ts b/src/types/markdownlint-rules.d.ts new file mode 100644 index 000000000000..7e7204208e76 --- /dev/null +++ b/src/types/markdownlint-rules.d.ts @@ -0,0 +1,7 @@ +// Simple type declaration for markdownlint external library +// Using any types to avoid complex typing for external dependencies + +declare module '../../../../node_modules/markdownlint/lib/rules' { + const rules: any[] + export = rules +} diff --git a/src/versions/lib/non-enterprise-default-version.js b/src/versions/lib/non-enterprise-default-version.ts similarity index 94% rename from src/versions/lib/non-enterprise-default-version.js rename to src/versions/lib/non-enterprise-default-version.ts index 5a438f0bf61d..23edb112520c 100644 --- a/src/versions/lib/non-enterprise-default-version.js +++ b/src/versions/lib/non-enterprise-default-version.ts @@ -1,6 +1,7 @@ import { allVersions } from '@/versions/lib/all-versions' + const nonEnterpriseDefaultVersion = Object.values(allVersions).find( (version) => version.nonEnterpriseDefault, -).version +)!.version export default nonEnterpriseDefaultVersion diff --git a/src/versions/lib/remove-fpt-from-path.js b/src/versions/lib/remove-fpt-from-path.ts similarity index 86% rename from src/versions/lib/remove-fpt-from-path.js rename to src/versions/lib/remove-fpt-from-path.ts index d93a9a29a1d7..32ee9ded6ff7 100644 --- a/src/versions/lib/remove-fpt-from-path.js +++ b/src/versions/lib/remove-fpt-from-path.ts @@ -4,6 +4,6 @@ import nonEnterpriseDefaultVersion from './non-enterprise-default-version' // This is a convenience function to remove free-pro-team@latest from all // **user-facing** aspects of the site (particularly URLs) while continuing to support // free-pro-team@latest as a version both in the codebase and in content/data files. -export default function removeFPTFromPath(path) { +export default function removeFPTFromPath(path: string): string { return slash(path.replace(`/${nonEnterpriseDefaultVersion}`, '')) }