Skip to content

Commit d690e8a

Browse files
authored
Merge pull request #40327 from github/repo-sync
Repo sync
2 parents 68f247a + 83b645e commit d690e8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+478
-262
lines changed

content/contributing/writing-for-github-docs/using-markdown-and-liquid-in-github-docs.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,76 @@ Code annotations only work in articles with the `layout: inline` frontmatter pro
144144

145145
For an example of an article that uses code annotations on {% data variables.product.prodname_docs %}, see [AUTOTITLE](/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions).
146146

147+
## {% data variables.product.prodname_copilot_short %} prompts
148+
149+
Prompts for {% data variables.product.prodname_copilot_short %} can either be displayed in blocks or included inline within text.
150+
151+
### Prompt blocks
152+
153+
These are very similar to code blocks, but use the `copilot` keyword rather than the name of a programming language.
154+
155+
Prompt blocks should always have a copy button, added using the `copy` option, and may also have a {% data variables.product.prodname_copilot_short %} button, added using the `prompt` option. The {% data variables.product.prodname_copilot_short %} button gives the reader a quick way to run the prompt in {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %}. The `copy` and `prompt` options can be used in any order.
156+
157+
#### Example prompt block with {% data variables.product.prodname_copilot_short %} and copy buttons
158+
159+
````markdown
160+
```copilot prompt copy
161+
What is git?
162+
```
163+
````
164+
165+
This is rendered as:
166+
167+
```copilot prompt copy
168+
What is git?
169+
```
170+
171+
You should only add a {% data variables.product.prodname_copilot_short %} button to a prompt block if:
172+
* The prompt can be run without any further context (as shown in the example above).
173+
* There is a code block in the same article that provides the required context for the prompt.
174+
175+
#### Including context with a prompt
176+
177+
If you use a {% data variables.product.prodname_copilot_short %} button, you can add context to the prompt that is sent to {% data variables.copilot.copilot_chat_short %} by referencing a code block in the same article. You do this by adding `id=STRING-OF-YOUR-CHOICE` to the code block and `ref=STRING-OF-YOUR-CHOICE` to the prompt block.
178+
179+
#### Example code block used as context within a prompt block
180+
181+
````markdown
182+
Add an id to the code block whose code you want to add to the prompt as context:
183+
184+
```javascript id=js-age
185+
function logPersonsAge(a, b, c) {
186+
if (c) {
187+
console.log(a + " is " + b + " years old.");
188+
} else {
189+
console.log(a + " does not want to reveal their age.");
190+
}
191+
}
192+
```
193+
194+
Then, elsewhere in the same article, reference the id in the prompt block:
195+
196+
```copilot copy prompt ref=js-age
197+
Improve the variable names in this function
198+
```
199+
````
200+
201+
There are many examples of prompt blocks with context in the {% data variables.product.prodname_copilot_short %} Cookbook. For example, see [AUTOTITLE](/free-pro-team@latest/copilot/tutorials/copilot-chat-cookbook/refactor-code/improve-code-readability).
202+
203+
### Inline prompts
204+
205+
For most inline prompts, mark these by using backticks, just like inline code.
206+
207+
If the prompt does not require any context, you can add a clickable {% data variables.product.prodname_copilot_short %} icon after the prompt. This allows the reader to run the prompt in {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %}. To add the clickable icon, surround the prompt with Liquid syntax tags:
208+
209+
```markdown
210+
{% raw %}... you can click {% prompt %}what is git{% endprompt %} to run this ...{% endraw %}
211+
```
212+
213+
This is rendered as:
214+
215+
... you can click {% prompt %}what is git{% endprompt %} to run this ...
216+
147217
## Octicons
148218

149219
Octicons are icons used across {% data variables.product.prodname_dotcom %}’s interface. We reference Octicons when documenting the user interface and to indicate binary values in tables. Find the name of specific Octicons on the [Octicons site](https://primer.style/octicons).

content/copilot/concepts/ai-tools.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ On {% data variables.product.github %}, use **{% data variables.product.prodname
4545

4646
Once you've chosen an issue to address, **{% data variables.copilot.copilot_chat_short %}** can help you brainstorm ideas for your project and learn about the various tools, libraries, and resources you might need. You can ask {% data variables.copilot.copilot_chat_short %} generalized questions about the project you're envisioning to get suggestions on a path forward. For example:
4747

48-
> I'd like to build an web app that helps users track their daily habits and provides personalized recommendations. Can you suggest features and technologies I could use?
48+
`I'd like to build an web app that helps users track their daily habits and provides personalized recommendations. Can you suggest features and technologies I could use?`
4949

5050
## Creation
5151

@@ -59,27 +59,27 @@ With **{% data variables.copilot.next_edit_suggestions %}** ({% data variables.r
5959

6060
Use {% data variables.copilot.copilot_chat_short %} in **ask mode** as your pair programmer to get help with coding tasks, understand tricky concepts, and improve your code. You can ask it questions, get explanations, or request suggestions in real time.
6161

62-
> Can you explain what this JavaScript function does? I'm not sure why it uses a `forEach` loop instead of a `for` loop.
62+
* `Can you explain what this JavaScript function does? I'm not sure why it uses a forEach loop instead of a for loop.`
6363

64-
> What’s the difference between `let`, `const`, and `var` in JavaScript? When should I use each one?
64+
* `What’s the difference between let, const, and var in JavaScript? When should I use each one?`
6565

6666
### Using {% data variables.copilot.copilot_chat_short %} in edit mode
6767

6868
Use {% data variables.copilot.copilot_chat_short %} in **edit mode** when you want more granular control over the edits that {% data variables.product.prodname_copilot_short %} proposes. In edit mode, you choose which files {% data variables.product.prodname_copilot_short %} can make changes to, provide context to {% data variables.product.prodname_copilot_short %} with each iteration, and decide whether or not to accept the suggested edits.
6969

70-
> Refactor the `calculateTotal` function to improve readability and efficiency.
70+
* `Refactor the calculateTotal function to improve readability and efficiency.`
7171

72-
> The login function is not working as expected. Can you debug it?
72+
* `The login function is not working as expected. Can you debug it?`
7373

74-
> Format this code to follow Python’s PEP 8 style guide.
74+
* `Format this code to follow Python’s PEP 8 style guide.`
7575

7676
### Using {% data variables.copilot.copilot_chat_short %} in agent mode
7777

7878
In **agent mode**, {% data variables.copilot.copilot_chat_short %} can assist with automating repetitive tasks and managing your workflow directly within your project. Use it to create pull requests after you make code changes. You can also use it to run tests and linters in the background while you're working on your project.
7979

80-
> Create a pull request for the recent changes in the `user-auth` module and include a summary of the updates.
80+
* `Create a pull request for the recent changes in the user-auth module and include a summary of the updates.`
8181

82-
> Run all tests and linters for the `payment-processing` module and provide a summary of any issues or errors found.
82+
* `Run all tests and linters for the payment-processing module and provide a summary of any issues or errors found.`
8383

8484
## Reviews
8585

@@ -98,25 +98,25 @@ The testing phase validates that your application works as intended. This phase
9898

9999
**{% data variables.copilot.copilot_chat_short %}** can assist by generating unit and integration tests, debugging failures, and suggesting additional test cases to ensure comprehensive coverage. Here are some example prompts:
100100

101-
> Write unit tests for this function to calculate the factorial of a number. Include edge cases like 0 and negative numbers.
101+
* `Write unit tests for this function to calculate the factorial of a number. Include edge cases like 0 and negative numbers.`
102102

103-
> How do I run these tests using Python's unittest framework?
103+
* `How do I run these tests using Python's unittest framework?`
104104

105-
> Write integration tests for the `deposit` function in the BankAccount class. Use mocks to simulate the NotificationSystem.
105+
* `Write integration tests for the deposit function in the BankAccount class. Use mocks to simulate the NotificationSystem.`
106106

107-
> What additional tests should I include to ensure full coverage for this module?
107+
* `What additional tests should I include to ensure full coverage for this module?`
108108

109109
## Deployment
110110

111111
The deployment phase involves preparing your code for production and ensuring a smooth release.
112112

113113
**{% data variables.copilot.copilot_chat_short %}** can help you configure deployment scripts, set up CI/CD pipelines, and troubleshoot issues. Here are some example prompts:
114114

115-
> Write a deployment script for a Node.js application using GitHub Actions to deploy to an AWS EC2 instance.
115+
* `Write a deployment script for a Node.js application using GitHub Actions to deploy to an AWS EC2 instance.`
116116

117-
> Set up a GitHub Actions workflow to build, test, and deploy a Python application to Heroku.
117+
* `Set up a GitHub Actions workflow to build, test, and deploy a Python application to Heroku.`
118118

119-
> Analyze this deployment log and suggest why the deployment failed.
119+
* `Analyze this deployment log and suggest why the deployment failed.`
120120

121121
## Operation
122122

@@ -126,11 +126,11 @@ You can use the **{% data variables.copilot.copilot_coding_agent %}** ({% data v
126126

127127
For issues you're tackling yourself, use **{% data variables.copilot.copilot_chat_short %}** for help analyzing logs, debugging issues, and suggesting optimizations. For example:
128128

129-
> Analyze this error log and suggest possible causes for the issue.
129+
* `Analyze this error log and suggest possible causes for the issue.`
130130

131-
> Write a script to monitor the memory usage of this application and alert when it exceeds a threshold.
131+
* `Write a script to monitor the memory usage of this application and alert when it exceeds a threshold.`
132132

133-
> How can I optimize the database queries in this code to improve performance?
133+
* `How can I optimize the database queries in this code to improve performance?`
134134

135135
## Next steps
136136

content/copilot/concepts/prompt-engineering.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,38 @@ When writing a prompt for {% data variables.product.prodname_copilot_short %}, f
2323

2424
For example:
2525

26-
> Write a function that tells me if a number is prime
27-
>
28-
> The function should take an integer and return true if the integer is prime
29-
>
30-
> The function should error if the input is not a positive integer
26+
```copilot copy prompt
27+
Write a JavaScript function that tells me if a number is prime
28+
29+
The function should take an integer and return true if the integer is prime
30+
31+
The function should error if the input is not a positive integer
32+
```
3133

3234
## Give examples
3335

3436
Use examples to help {% data variables.product.prodname_copilot_short %} understand what you want. You can provide example input data, example outputs, and example implementations.
3537

3638
For example:
3739

38-
> Write a function that finds all dates in a string and returns them in an array. Dates can be formatted like:
39-
>
40-
> * 05/02/24
41-
> * 05/02/2024
42-
> * 5/2/24
43-
> * 5/2/2024
44-
> * 05-02-24
45-
> * 05-02-2024
46-
> * 5-2-24
47-
> * 5-2-2024
48-
>
49-
> Example:
50-
>
51-
> findDates("I have a dentist appointment on 11/14/2023 and book club on 12-1-23")
52-
>
53-
> Returns: ["11/14/2023", "12-1-23"]
40+
```copilot copy prompt
41+
Write a Go function that finds all dates in a string and returns them in an array. Dates can be formatted like:
42+
43+
* 05/02/24
44+
* 05/02/2024
45+
* 5/2/24
46+
* 5/2/2024
47+
* 05-02-24
48+
* 05-02-2024
49+
* 5-2-24
50+
* 5-2-2024
51+
52+
Example:
53+
54+
findDates("I have a dentist appointment on 11/14/2023 and book club on 12-1-23")
55+
56+
Returns: ["11/14/2023", "12-1-23"]
57+
```
5458

5559
Unit tests can also serve as examples. Before writing your function, you can use {% data variables.product.prodname_copilot_short %} to write unit tests for the function. Then, you can ask {% data variables.product.prodname_copilot_short %} to write a function described by those unit tests.
5660

content/copilot/get-started/quickstart.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ To use {% data variables.product.prodname_copilot_short %} on the {% data variab
5252

5353
For example, you could enter:
5454

55-
* Explain this file.
56-
* How could I improve this code?
57-
* How can I test this code?
55+
* `Explain this file.`
56+
* `How could I improve this code?`
57+
* `How can I test this code?`
5858

5959
{% data variables.product.prodname_copilot_short %} responds to your request in the panel.
6060

content/copilot/how-tos/provide-context/use-mcp/use-the-github-mcp-server.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ To configure the remote {% data variables.product.github %} MCP server with a PA
434434
}
435435
}
436436
```
437-
437+
438438
## Using the {% data variables.product.github %} MCP server in Xcode
439439

440440
The {% data variables.product.github %} MCP server enables you to perform a wide range of actions on {% data variables.product.github %}, via {% data variables.copilot.copilot_chat_short %} in Xcode.
@@ -546,8 +546,12 @@ The {% data variables.product.github %} MCP server is automatically configured i
546546
1. In the prompt box, type a request related to the skill you want {% data variables.copilot.copilot_chat_short %} to perform, and press **Enter**.
547547

548548
Some examples of requests you can make are:
549-
* `Create a new branch called [BRANCH-NAME] in the repository [USERNAME/REPO-NAME].`
550-
* `Merge the pull request [PULL-REQUEST-NUMBER] in the repository [USERNAME/REPO-NAME].`
549+
550+
{% prompt %}Create a new branch called [BRANCH-NAME] in the repository [OWNER/REPO-NAME].{% endprompt %}
551+
552+
{% prompt %}Search for users with the name [USER-NAME]{% endprompt %}
553+
554+
{% prompt %}Merge the pull request [PR-NUMBER] in the repository [OWNER/REPO-NAME].{% endprompt %}
551555

552556
1. {% data variables.copilot.copilot_chat_short %} will ask you to confirm that you want to proceed with the action. Click **Allow** to confirm.
553557
1. {% data variables.copilot.copilot_chat_short %} will use the relevant skill from the {% data variables.product.github %} MCP server to perform the action you requested. {% data variables.copilot.copilot_chat_short %} will show you the result of the action in the chat interface.

content/copilot/how-tos/use-chat/get-started-with-chat.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ Some of the example prompts require you to be in a specific context on the {% da
251251

252252
You can ask {% data variables.copilot.copilot_chat_short %} general software questions. For example:
253253

254-
* `tell me about nodejs web server frameworks`
255-
* `how can I create an Express app`
256-
* `what is the best way to update an npm package`
254+
* {% prompt %}tell me about nodejs web server frameworks{% endprompt %}
255+
* {% prompt %}how can I create an Express app{% endprompt %}
256+
* {% prompt %}what is the best way to update an npm package{% endprompt %}
257257

258258
## Ask questions about a repository
259259

content/copilot/how-tos/use-chat/use-chat-in-github.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ Depending on the question you ask, and your enterprise and organization settings
3535

3636
Some examples of general questions you could ask are:
3737

38-
* `What are the advantages of the Go programming language?`
39-
* `What is Agile software development?`
40-
* `What is the most popular JavaScript framework?`
41-
* `Give me some examples of regular expressions.`
42-
* `Write a bash script to output today's date.`
38+
* {% prompt %}What are the advantages of the Go programming language?{% endprompt %}
39+
* {% prompt %}What is Agile software development?{% endprompt %}
40+
* {% prompt %}What is the most popular JavaScript framework?{% endprompt %}
41+
* {% prompt %}Give me some examples of regular expressions.{% endprompt %}
42+
* {% prompt %}Write a bash script to output today's date.{% endprompt %}
4343

4444
{% data reusables.copilot.stop-response-generation %}
4545
1. If {% data variables.product.prodname_copilot_short %} uses a Bing search to answer your question, you can click the **_n_ references** link at the top of the response to see the search results that {% data variables.product.prodname_copilot_short %} used to answer your question.
@@ -59,7 +59,7 @@ Depending on the question you ask, and your enterprise and organization settings
5959
6060
When you ask a question, {% data variables.product.prodname_copilot_short %} may generate one or more files as part of its response. In the {% data variables.copilot.copilot_chat_short %} panel, the files are displayed inline, within the chat response. In immersive view (that is, at [https://github.com/copilot](https://github.com/copilot)), the generated files are displayed in a side panel. You can view and edit the files in the panel, or download them to your computer.
6161

62-
For example, asking `Generate a simple calculator using HTML, CSS, and JavaScript` may generate multiple files, such as `index.html`, `styles.css`, and `script.js`.
62+
For example, asking {% prompt %}Generate a simple calculator using HTML, CSS, and JavaScript{% endprompt %} may generate multiple files, such as `index.html`, `styles.css`, and `script.js`.
6363

6464
In immersive view, you can also preview how some file formats, such as Markdown, render by toggling to the "Preview" tab in the side panel.
6565

@@ -118,9 +118,9 @@ To navigate between subthreads:
118118

119119
{% data variables.product.prodname_copilot_short %} has access to a collection of skills to fetch data from {% data variables.product.github %}, which are dynamically selected based on the question you ask.
120120

121-
You can explicitly ask {% data variables.copilot.copilot_chat_dotcom %} to use a particular skill - for example, `Use the Bing skill to find the latest GPT4 model from OpenAI`.
121+
You can explicitly ask {% data variables.copilot.copilot_chat_dotcom %} to use a particular skill - for example, {% prompt %}Use the Bing skill to find the latest GPT4 model from OpenAI.{% endprompt %}
122122

123-
Generate a list of currently available skills by asking {% data variables.product.prodname_copilot_short %}: `What skills are available?`
123+
Generate a list of currently available skills by asking {% data variables.product.prodname_copilot_short %}: {% prompt %}What skills are available?{% endprompt %}
124124

125125
## Asking {% data variables.copilot.copilot_chat_short %} questions in different contexts
126126

@@ -171,9 +171,9 @@ You can ask {% data variables.product.prodname_copilot_short %} a question about
171171

172172
For example, you could enter:
173173

174-
* What does this repo do?
175-
* Where is authentication implemented in this codebase?
176-
* How does license file detection work in this repo?
174+
* `What does this repo do?`
175+
* `Where is authentication implemented in this codebase?`
176+
* `How does license file detection work in this repo?`
177177

178178
1. Click **Ask {% data variables.product.prodname_copilot_short %}**.
179179

0 commit comments

Comments
 (0)