diff --git a/content/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-azure.md b/content/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-azure.md index fa1daec8bc2e..87801dc74ccc 100644 --- a/content/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-azure.md +++ b/content/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-azure.md @@ -91,7 +91,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Az CLI login' - uses: azure/login@a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0 + uses: azure/login@v2 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} diff --git a/content/copilot/concepts/code-review/code-review.md b/content/copilot/concepts/code-review/code-review.md index d31b27357d07..81a79161f843 100644 --- a/content/copilot/concepts/code-review/code-review.md +++ b/content/copilot/concepts/code-review/code-review.md @@ -57,6 +57,10 @@ When you reach your monthly quota you will not be able to get a code review from * Premium feature. Uses one premium request from your monthly quota per review. * Supports custom instructions and custom coding guidelines. +## Providing instructions for {% data variables.product.prodname_copilot_short %} code reviews + +You can tailor the reviews that {% data variables.product.prodname_copilot_short %} generates by providing custom instructions. This helps {% data variables.product.prodname_copilot_short %} to review the code in a way that matches your team's coding standards, tools, and practices. See [AUTOTITLE](/copilot/how-tos/configure-custom-instructions/add-repository-instructions?tool=webui) and [AUTOTITLE](/copilot/how-tos/configure-custom-instructions/add-organization-instructions). + ## Validating {% data variables.product.prodname_copilot_short %} code reviews {% data variables.product.prodname_copilot_short %} isn't guaranteed to spot all problems or issues in a pull request, and sometimes it will make mistakes. Always validate {% data variables.product.prodname_copilot_short %}'s feedback carefully, and supplement {% data variables.product.prodname_copilot_short %}'s feedback with a human review. diff --git a/content/copilot/concepts/response-customization.md b/content/copilot/concepts/response-customization.md index a3e81b175328..9ec650e8cbba 100644 --- a/content/copilot/concepts/response-customization.md +++ b/content/copilot/concepts/response-customization.md @@ -59,13 +59,9 @@ contentType: concepts ### About repository custom instructions -Repository custom instructions consist of a single file, `.github/copilot-instructions.md`, that you create in a repository. +You can create two types of repository custom instructions for {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %}: -Repository custom instructions files are used for chat responses, for code review, and also by {% data variables.product.prodname_copilot_short %} when you assign it to an issue or ask it to create a pull request. Instructions included in this file can help {% data variables.product.prodname_copilot_short %} to work on files in a way that matches your team's working practices and conforms to coding standards for your project. See [AUTOTITLE](/copilot/using-github-copilot/coding-agent/about-assigning-tasks-to-copilot). - -{% data reusables.copilot.repository-custom-instructions-example %} - -{% data reusables.copilot.repository-cust-instr-code-review %} +{% data reusables.copilot.custom-instructions-about %} {% endwebui %} @@ -75,7 +71,7 @@ Repository custom instructions files are used for chat responses, for code revie There are two types of files you can use to provide context and instructions to {% data variables.copilot.copilot_chat %} in {% data variables.product.prodname_vscode_shortname %}: -* **Repository custom instructions** allow you to specify repository-wide instructions and preferences, in a single file, that apply to any conversation held in the context of the repository. +* **Repository custom instructions** allow you to specify instructions and preferences that {% data variables.product.prodname_copilot_short %} will consider when working in the context of the repository. * **Prompt files** (public preview) allow you to save common prompt instructions and relevant context in Markdown files (`*.prompt.md`) that you can then reuse in your chat prompts. Prompt files are only available in {% data variables.product.prodname_vscode_shortname %}. While custom instructions help to add codebase-wide context to each AI workflow, prompt files let you add instructions to a specific chat interaction. @@ -117,7 +113,9 @@ There are two types of repository custom instructions you can use to provide con Custom instructions consist of natural language instructions and are most effective when they are short, self-contained statements. Consider the scope over which you want the instruction to apply when choosing whether to add an instruction on the personal, repository, or (if available) organization level. -{% data reusables.copilot.custom-instructions-interactions-note %} +> [!NOTE] +> * {% data reusables.copilot.custom-instructions-chat-precedence %} +> * {% data reusables.copilot.custom-instructions-conflict %} Here are some common use cases and examples for each type of custom instructions: * **Personal custom instructions:** @@ -138,19 +136,9 @@ Here are some common use cases and examples for each type of custom instructions ## About repository custom instructions -Repository custom instructions consist of a single file, `.github/copilot-instructions.md`, that you create in a repository. The instructions you add to the file should be short, self-contained statements that add context or relevant information to supplement chat questions. - -Common use cases include: - -* **Test generation.** Create instructions for test generation, such as specifying the use of a certain test framework. -* **Code review.** Specify instructions for reviewing code, such as telling a reviewer to look for a specific error in the code. -* **Commit message generation.** Write instructions for generating commit messages, such as format or the type of information to include. - -### Example - -{% data reusables.copilot.repository-custom-instructions-example %} +You can create two types of repository custom instructions for use in {% data variables.product.prodname_vscode_shortname %}: -{% data reusables.copilot.repository-cust-instr-code-review %} +{% data reusables.copilot.custom-instructions-about %} ## About prompt files diff --git a/content/copilot/how-tos/configure-custom-instructions/add-organization-instructions.md b/content/copilot/how-tos/configure-custom-instructions/add-organization-instructions.md index cd3e4752b4f8..794cd84fe02c 100644 --- a/content/copilot/how-tos/configure-custom-instructions/add-organization-instructions.md +++ b/content/copilot/how-tos/configure-custom-instructions/add-organization-instructions.md @@ -1,7 +1,7 @@ --- title: Adding organization custom instructions for GitHub Copilot shortTitle: Add organization instructions -intro: 'Customize {% data variables.copilot.copilot_chat %} responses for members of your organization.' +intro: 'Customize {% data variables.product.prodname_copilot_short %} responses for members of your organization.' permissions: Organization owners product: 'Organizations with a {% data variables.copilot.copilot_for_business %} or {% data variables.copilot.copilot_enterprise %} plan' versions: @@ -15,18 +15,28 @@ redirect_from: contentType: how-tos --- -{% data reusables.copilot.organization-instructions-note %} +> [!NOTE] +> This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change. +> +> Organization custom instructions are currently only supported for {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %} and {% data variables.copilot.copilot_code-review_short %}. For an overview of the methods you can use to customize {% data variables.copilot.copilot_chat %} responses, see [AUTOTITLE](/copilot/concepts/about-customizing-github-copilot-chat-responses?tool=webui). -## About organization custom instructions for {% data variables.copilot.copilot_chat %} +## About organization custom instructions for {% data variables.product.prodname_copilot_short %} -Organization owners can add instructions for {% data variables.copilot.copilot_chat %} in order to tailor chat responses to the needs and preferences of your organization. For example, you can choose to always have {% data variables.copilot.copilot_chat_short %} respond in your company's language of choice or with a particular style. Some examples of instructions you could add are: +Organization owners can add instructions for {% data variables.product.prodname_copilot_short %}, to tailor responses to the needs and preferences of your organization. For example, you can choose to always have {% data variables.copilot.copilot_chat_short %} respond in your company's language of choice or with a particular style. + +Custom instructions defined in an organization's {% data variables.product.prodname_copilot_short %} settings are used for all members of the organization, irrespective of whether they receive their {% data variables.product.prodname_copilot_short %} subscription from that organization. + +Some examples of instructions you could add are: * `Always respond in Spanish.` * `Do not generate code blocks in responses.` * `For questions related to security, use the Security Docs Knowledge Base.` -{% data reusables.copilot.custom-instructions-interactions-note %} +> [!NOTE] +> * {% data reusables.copilot.custom-instructions-chat-precedence %} +> * For {% data variables.copilot.copilot_code-review_short %}, the order of precedence is: instructions in any applicable `.github/instructions/NAME.instructions.md` file, then the instructions in the `.github/copilot-instructions.md` file, then the organization-level custom instructions. +> * {% data reusables.copilot.custom-instructions-conflict %} ## Adding organization custom instructions diff --git a/content/copilot/how-tos/configure-custom-instructions/add-personal-instructions.md b/content/copilot/how-tos/configure-custom-instructions/add-personal-instructions.md index eb642972d2c7..6bfdad5547ea 100644 --- a/content/copilot/how-tos/configure-custom-instructions/add-personal-instructions.md +++ b/content/copilot/how-tos/configure-custom-instructions/add-personal-instructions.md @@ -24,7 +24,9 @@ You can add custom instructions for {% data variables.copilot.copilot_chat %} in * `Your style is a helpful colleague, minimize explanations but provide enough context to understand the code.` * `Always provide examples in TypeScript.` -{% data reusables.copilot.custom-instructions-interactions-note %} +> [!NOTE] +> * {% data reusables.copilot.custom-instructions-chat-precedence %} +> * {% data reusables.copilot.custom-instructions-conflict %} ## Adding personal custom instructions diff --git a/content/copilot/how-tos/configure-custom-instructions/add-repository-instructions.md b/content/copilot/how-tos/configure-custom-instructions/add-repository-instructions.md index 5b840a02a87e..90d79a43422a 100644 --- a/content/copilot/how-tos/configure-custom-instructions/add-repository-instructions.md +++ b/content/copilot/how-tos/configure-custom-instructions/add-repository-instructions.md @@ -56,7 +56,11 @@ This version of this article is for using repository custom instructions in Ecli Repository custom instructions let you provide {% data variables.product.prodname_copilot_short %} with repository-specific guidance and preferences. -{% data reusables.copilot.repository-custom-instructions-support %} +Repository custom instructions are currently supported for: +* **{% data variables.copilot.copilot_chat_short %}** in {% data variables.product.prodname_vscode_shortname %} +* **{% data variables.copilot.copilot_chat_short %}** in {% data variables.product.prodname_vs %}, JetBrains IDEs, Xcode, Eclipse, and on the {% data variables.product.github %} website (`copilot-instructions.md` file only) +* **{% data variables.copilot.copilot_coding_agent %}** +* **{% data variables.copilot.copilot_code-review_short %}** ## Prerequisites for repository custom instructions @@ -98,13 +102,13 @@ Repository custom instructions let you provide {% data variables.product.prodnam {% endeclipse %} -## Creating a repository custom instructions file +## Creating custom instructions {% jetbrains %} -JetBrains IDEs support a single `.github/copilot-instructions.md` custom instructions file stored in the repository. +JetBrains IDEs support a single `.github/copilot-instructions.md` custom instructions file stored in the repository, and a locally stored `global-copilot-instructions.md` file. -You can create a custom instructions file in your repository using the {% data variables.product.prodname_copilot_short %} settings page, or you can create the file manually. +You can create the `.github/copilot-instructions.md` file in your repository using the {% data variables.product.prodname_copilot_short %} settings page, or you can create the file manually. Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. @@ -184,40 +188,31 @@ Once saved, these instructions will apply to the current project in Eclipse that {% vscode %} -{% data variables.product.prodname_vscode_shortname %} supports either: +{% data variables.product.prodname_vscode_shortname %} supports two types of repository custom instructions: -* A single `.github/copilot-instructions.md` custom instructions file stored in the repository -* One or more `.instructions.md` files stored within `.github/instructions` in the repository. Each file can specify `applyTo` frontmatter to define what files or directories its instructions apply to. +* **Repository-wide custom instructions**, which apply to all requests made in the context of a repository. -### Using a single `.github/copilot-instructions.md` file + These are specified in a `copilot-instructions.md` file in the `.github` directory of the repository. See [Creating repository-wide custom instructions](#creating-repository-wide-custom-instructions). -1. In the root of your repository, create a file named `.github/copilot-instructions.md`. +* **Path-specific custom instructions**, which apply to requests made in the context of files that match a specified path. - Create the `.github` directory if it does not already exist. + These are specified in one or more `NAME.instructions.md` files within the `.github/instructions` directory in the repository. See [Creating path-specific custom instructions](#creating-path-specific-custom-instructions). -1. Add natural language instructions to the file, in Markdown format. + If the path you specify matches a file that {% data variables.product.prodname_copilot_short %} is working on, and a repository-wide custom instructions file also exists, then the instructions from both files are used. - Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. +## Creating repository-wide custom instructions -### Using one or more `.instructions.md` files +1. In the root of your repository, create a file named `.github/copilot-instructions.md`. -1. Create the `.github/instructions` directory if it does not already exist. + Create the `.github` directory if it does not already exist. -1. Create one or more `.instructions.md` files, adding natural language instructions to the file(s). +1. Add natural language instructions to the file, in Markdown format. Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. -1. Specify what files or directories the instructions apply to by adding `applyTo` frontmatter to the Markdown files, using glob syntax. +## Creating path-specific custom instructions - ```markdown - --- - applyTo: "app/models/**/*.rb" - --- - - Add custom instructions here - ``` - - To apply the instructions to all files, use the `**` pattern. +{% data reusables.copilot.custom-instructions-path %} {% endvscode %} @@ -237,19 +232,35 @@ Once saved, these instructions will apply to the current project in Eclipse that {% webui %} -**{% data variables.copilot.copilot_chat_short %}** on the {% data variables.product.github %} website, **{% data variables.copilot.copilot_coding_agent %}** and **{% data variables.copilot.copilot_code-review_short %}** support a single `.github/copilot-instructions.md` custom instructions file stored in the repository. +You can create several types of repository custom instructions for use on {% data variables.product.prodname_dotcom_the_website %}: + +* **Repository-wide custom instructions** apply to all requests made in the context of a repository. + + Supported by: **{% data variables.copilot.copilot_chat_short %}**, **{% data variables.copilot.copilot_coding_agent %}**, and **{% data variables.copilot.copilot_code-review_short %}**. + + These are specified in a `copilot-instructions.md` file in the `.github` directory of the repository. See [Creating repository-wide custom instructions](#creating-repository-wide-custom-instructions-1). + +* **Path-specific custom instructions** apply to requests made in the context of files that match a specified path. -In addition, **{% data variables.copilot.copilot_coding_agent %}** supports: + Supported by: **{% data variables.copilot.copilot_coding_agent %}** and **{% data variables.copilot.copilot_code-review_short %}**. -* One or more `.instructions.md` files stored within `.github/instructions` in the repository. Each file can specify `applyTo` frontmatter to define what files or directories its instructions apply to. -* One or more `AGENTS.md` files stored anywhere within the repository. When {% data variables.product.prodname_copilot_short %} is working, the nearest `AGENTS.md` file in the directory tree will take precedence. -* A single `CLAUDE.md` or `GEMINI.md` file stored in the root of the repository. + These are specified in one or more `NAME.instructions.md` files within the `.github/instructions` directory in the repository. See [Creating path-specific custom instructions](#creating-path-specific-custom-instructions-1). -### Using a single `.github/copilot-instructions.md` file + If the path you specify matches a file that {% data variables.product.prodname_copilot_short %} is working on, and a repository-wide custom instructions file also exists, then the instructions from both files are used. -You can ask {% data variables.copilot.copilot_coding_agent %} to generate a `.github/copilot-instructions.md` file, or you can write your own instructions file. +* **Agent instructions** are used by AI agents. -#### Asking {% data variables.copilot.copilot_coding_agent %} to generate a `.github/copilot-instructions.md` file + Supported by: **{% data variables.copilot.copilot_coding_agent %}**. + + You can create one or more `AGENTS.md` files, stored anywhere within the repository. When {% data variables.product.prodname_copilot_short %} is working, the nearest `AGENTS.md` file in the directory tree will take precedence. + + Alternatively, you can use a single `CLAUDE.md` or `GEMINI.md` file stored in the root of the repository. + +## Creating repository-wide custom instructions + +You can create your own custom instructions file from scratch. See [Writing your own copilot-instructions.md file](#writing-your-own-copilot-instructionsmd-file). Alternatively, you can ask {% data variables.copilot.copilot_coding_agent %} to generate one for you. + +### Asking {% data variables.copilot.copilot_coding_agent %} to generate a `copilot-instructions.md` file > [!NOTE] > {% data reusables.copilot.coding-agent.preview-note-text %} @@ -341,7 +352,7 @@ You can ask {% data variables.copilot.copilot_coding_agent %} to generate a `.gi {% data variables.product.prodname_copilot_short %} will start a new session, which will appear in the list below the prompt box. {% data variables.product.prodname_copilot_short %} will create a draft pull request, write your custom instructions, push them to the branch, then add you as a reviewer when it has finished, triggering a notification. -#### Writing your own `.github/copilot-instructions.md` file +### Writing your own `copilot-instructions.md` file 1. In the root of your repository, create a file named `.github/copilot-instructions.md`. @@ -354,25 +365,12 @@ You can ask {% data variables.copilot.copilot_coding_agent %} to generate a `.gi > [!TIP] > The first time you create a pull request in a given repository with {% data variables.copilot.copilot_coding_agent %}, {% data variables.product.prodname_copilot_short %} will leave a comment with a link to automatically generate custom instructions for the repository. -### Using one or more `.instructions.md` files - -1. Create the `.github/instructions` directory if it does not already exist. - -1. Create one or more `.instructions.md` files, adding natural language instructions to the file(s). +## Creating path-specific custom instructions - Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. - -1. Specify what files or directories the instructions apply to by adding `applyTo` frontmatter to the Markdown files, using glob syntax. - - ```markdown - --- - applyTo: "app/models/**/*.rb" - --- - - Add custom instructions here - ``` +> [!NOTE] +> Currently, on {% data variables.product.prodname_dotcom_the_website %}, path-specific custom instructions are only supported for {% data variables.copilot.copilot_coding_agent %} and {% data variables.copilot.copilot_code-review_short %}. - To apply the instructions to all files, use the `**` pattern. +{% data reusables.copilot.custom-instructions-path %} {% endwebui %} @@ -459,7 +457,9 @@ Whenever repository custom instructions are used by {% data variables.copilot.co You can click the reference to open the file. -{% data reusables.copilot.custom-instructions-interactions-note %} +> [!NOTE] +> * {% data reusables.copilot.custom-instructions-chat-precedence %} +> * {% data reusables.copilot.custom-instructions-conflict %} {% endwebui %} diff --git a/content/copilot/tutorials/coding-agent/get-the-best-results.md b/content/copilot/tutorials/coding-agent/get-the-best-results.md index 95b48d5a0baf..df2141711433 100644 --- a/content/copilot/tutorials/coding-agent/get-the-best-results.md +++ b/content/copilot/tutorials/coding-agent/get-the-best-results.md @@ -91,7 +91,7 @@ For more information, see [AUTOTITLE](/copilot/customizing-copilot/adding-reposi To add instructions that apply to all tasks assigned to {% data variables.product.prodname_copilot_short %} in your repository, create a `.github/copilot-instructions.md` file in the root of your repository. This file should contain information about your project, such as how to build and test it, and any coding standards or conventions you want {% data variables.product.prodname_copilot_short %} to follow. Note that the instructions will also apply to {% data variables.copilot.copilot_chat_short %} and {% data variables.copilot.copilot_code-review_short %}. -The first time you ask {% data variables.product.prodname_copilot_short %} to create a pull request in a given repository, {% data variables.product.prodname_copilot_short %} will leave a comment with a link to automatically generate custom instructions. You can also ask {% data variables.product.prodname_copilot_short %} to generate custom instructions for you at any time using our recommended prompt. See [AUTOTITLE](/copilot/how-tos/configure-custom-instructions/add-repository-instructions?tool=webui#asking-copilot-coding-agent-to-generate-a-githubcopilot-instructionsmd-file). +The first time you ask {% data variables.product.prodname_copilot_short %} to create a pull request in a given repository, {% data variables.product.prodname_copilot_short %} will leave a comment with a link to automatically generate custom instructions. You can also ask {% data variables.product.prodname_copilot_short %} to generate custom instructions for you at any time using our recommended prompt. See [AUTOTITLE](/copilot/how-tos/configure-custom-instructions/add-repository-instructions?tool=webui#asking-copilot-coding-agent-to-generate-a-copilot-instructionsmd-file). You can also choose to write your own custom instructions at any time. Here is an example of an effective `copilot-instructions.md` file: diff --git a/data/reusables/copilot/code-review/custom-instructions-information.md b/data/reusables/copilot/code-review/custom-instructions-information.md index ff3daa4ea238..8b0c94cb8b54 100644 --- a/data/reusables/copilot/code-review/custom-instructions-information.md +++ b/data/reusables/copilot/code-review/custom-instructions-information.md @@ -1,4 +1,10 @@ -You can customize {% data variables.copilot.copilot_code-review_short %} by adding a `.github/copilot-instructions.md` file in your repository containing information that you want {% data variables.product.prodname_copilot_short %} to consider when reviewing code. This is the same `copilot-instructions.md` used by {% data variables.copilot.copilot_chat_short %}. See [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot). +You can customize {% data variables.copilot.copilot_code-review_short %} by adding custom instructions to your repository. + +Repository custom instructions can either be repository wide or path specific. You specify repository-wide custom instructions in a `.github/copilot-instructions.md` file in your repository. You can use this file to store information that you want {% data variables.product.prodname_copilot_short %} to consider when reviewing code anywhere in the repository. + +You can also write instructions that {% data variables.product.prodname_copilot_short %} will only use when reviewing code in files that match a specified path. You write these instructions in one or more `.github/instructions/NAME.instructions.md` files. + +For more information, see [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot). ### Example @@ -7,7 +13,7 @@ This example of a `.github/copilot-instructions.md` file contains three instruct ```text When performing a code review, respond in Spanish. -When performing a code review, follow our internal security checklist. +When performing a code review, apply the checks in the `/security/security-checklist.md` file. When performing a code review, focus on readability and avoid nested ternary operators. ``` diff --git a/data/reusables/copilot/custom-instructions-about.md b/data/reusables/copilot/custom-instructions-about.md new file mode 100644 index 000000000000..b5e9e0ec6592 --- /dev/null +++ b/data/reusables/copilot/custom-instructions-about.md @@ -0,0 +1,16 @@ +* **Repository-wide custom instructions**, which apply to all requests made in the context of a repository. + + These are specified in a `copilot-instructions.md` file in the `.github` directory of the repository. + + Repository-wide custom instructions files are used for chat responses, for code review, and also by {% data variables.copilot.copilot_coding_agent %}. + +* **Path-specific custom instructions**, which apply to requests made in the context of files that match a specified path. + + These are specified in one or more `NAME.instructions.md` files within the `.github/instructions` directory in the repository. + + By using path-specific instructions you can avoid overloading your repository-wide instructions with information that only applies to files of certain types, or in certain directories. + + > [!NOTE] + > Currently, path-specific custom instructions files are only used by {% data variables.copilot.copilot_code-review_short %}, {% data variables.copilot.copilot_coding_agent %}, and {% data variables.copilot.copilot_chat_short %} in {% data variables.product.prodname_vscode_shortname %}. + +For more information, see [AUTOTITLE](/copilot/how-tos/configure-custom-instructions/add-repository-instructions). diff --git a/data/reusables/copilot/custom-instructions-chat-precedence.md b/data/reusables/copilot/custom-instructions-chat-precedence.md new file mode 100644 index 000000000000..d859827a5f64 --- /dev/null +++ b/data/reusables/copilot/custom-instructions-chat-precedence.md @@ -0,0 +1 @@ +Multiple types of custom instructions can apply to a {% data variables.copilot.copilot_chat_short %} conversation. Personal instructions take the highest priority, followed by repository instructions, with organization instructions prioritized last. However, all sets of relevant instructions are still combined and provided to {% data variables.copilot.copilot_chat_short %}. diff --git a/data/reusables/copilot/custom-instructions-conflict.md b/data/reusables/copilot/custom-instructions-conflict.md new file mode 100644 index 000000000000..197e94373be4 --- /dev/null +++ b/data/reusables/copilot/custom-instructions-conflict.md @@ -0,0 +1 @@ +Whenever possible, you should avoid providing conflicting sets of instructions. If you are concerned about response quality, you can also choose to temporarily disable repository instructions. See [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot?tool=webui#enabling-or-disabling-repository-custom-instructions). diff --git a/data/reusables/copilot/custom-instructions-interactions-note.md b/data/reusables/copilot/custom-instructions-interactions-note.md deleted file mode 100644 index 12d4a85ea3dc..000000000000 --- a/data/reusables/copilot/custom-instructions-interactions-note.md +++ /dev/null @@ -1,3 +0,0 @@ -> [!NOTE] -> * It is possible for multiple types of custom instructions to apply to a conversation. Personal instructions take the highest priority, followed by repository instructions, with organization instructions prioritized last. However, all sets of relevant instructions are still combined and provided to {% data variables.copilot.copilot_chat_short %}. -> * Whenever possible, you should avoid providing conflicting sets of instructions. If you are concerned about response quality, you can also choose to temporarily disable repository instructions. See [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot?tool=webui#enabling-or-disabling-repository-custom-instructions). diff --git a/data/reusables/copilot/custom-instructions-path.md b/data/reusables/copilot/custom-instructions-path.md new file mode 100644 index 000000000000..a2d60c840108 --- /dev/null +++ b/data/reusables/copilot/custom-instructions-path.md @@ -0,0 +1,25 @@ +1. Create the `.github/instructions` directory if it does not already exist. + +1. Create one or more `NAME.instructions.md` files, where `NAME` indicates the purpose of the instructions. The file name must end with `.instructions.md`. + +1. At the start of the file, create a frontmatter block containing the `applyTo` keyword. Use glob syntax to specify what files or directories the instructions apply to. + + For example: + + ```markdown + --- + applyTo: "app/models/**/*.rb" + --- + ``` + + You can specify multiple patterns by separating them with commas. For example, to apply the instructions to all TypeScript files in the repository, you could use the following frontmatter block: + + ```markdown + --- + applyTo: "**/*.ts,**/*.tsx" + --- + ``` + + To apply the instructions to all files, use `applyTo: "**"`. + +1. Add your custom instructions in natural language, using Markdown format. Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. diff --git a/data/reusables/copilot/repository-custom-instructions-support.md b/data/reusables/copilot/repository-custom-instructions-support.md deleted file mode 100644 index eb2ce23a406e..000000000000 --- a/data/reusables/copilot/repository-custom-instructions-support.md +++ /dev/null @@ -1,5 +0,0 @@ -Repository custom instructions are currently supported for: -* **{% data variables.copilot.copilot_chat_short %}** in {% data variables.product.prodname_vscode_shortname %} -* **{% data variables.copilot.copilot_coding_agent %}** -* **{% data variables.copilot.copilot_chat_short %}** in {% data variables.product.prodname_vs %}, JetBrains IDEs, Xcode, Eclipse, and on the {% data variables.product.github %} website (`copilot-instructions.md` file only) -* **{% data variables.copilot.copilot_code-review_short %}** (`copilot-instructions.md` file only) diff --git a/src/rest/components/get-rest-code-samples.ts b/src/rest/components/get-rest-code-samples.ts index bff5fee3ca8d..175a92a0de25 100644 --- a/src/rest/components/get-rest-code-samples.ts +++ b/src/rest/components/get-rest-code-samples.ts @@ -206,9 +206,14 @@ export function getGHExample( } if (typeof bodyParameters === 'object') { + // Special handling for gist endpoints - use --input for nested file structures + const isGistEndpoint = + operation.requestPath.includes('/gists') && + (operation.title === 'Create a gist' || operation.title === 'Update a gist') + // For complex objects with arrays, use --input with JSON const hasArrays = hasNestedArrays(bodyParameters as NestedObjectParameter) - if (hasArrays) { + if (hasArrays || isGistEndpoint) { const jsonBody = JSON.stringify( bodyParameters, (key: string, value: any) => {