Skip to content

Commit 2eddd0f

Browse files
committed
Refine workshop content to clarify GitHub Copilot's role and enhance user guidance on feature implementation and testing.
1 parent 20bce48 commit 2eddd0f

File tree

1 file changed

+44
-8
lines changed

1 file changed

+44
-8
lines changed

content/5-code.md

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
| [← Helping GitHub Copilot understand context][walkthrough-previous] | [Next: GitHub flow →][walkthrough-next] |
44
|:-----------------------------------|------------------------------------------:|
55

6-
We've explored how we can use GitHub Copilot to explore our project and to provide context to ensure the suggestions we receive are to the quality we expect. Now let's turn our attention to putting all this prep work into action by generating new code! We'll use GitHub Copilot to aid us in adding functionality to our website and generate the necessary unit tests.
6+
To truly experience the newly created workflow in action, and eventually the GitHub flow (which we'll see in the next exercise) we're going to add a small feature to our website. You'll do this by asking [GitHub Copilot][github-copilot] to generate the required code - and tests.
77

88
> [!IMPORTANT]
9-
> Something something, we're not going too deep into copilot, check out our other amazing workshop!!
9+
> The focus of this workshop is on DevOps with GitHub. If you'd like to explore more about GitHub Copilot in workshop form, you can see [Agents in SDLC][agents-in-sdlc], which is also available on [GitHub-samples][github-samples].
1010
1111
## Scenario
1212

@@ -20,7 +20,10 @@ To streamline the creation of both the feature and required infrastructure you'l
2020

2121
In the [prior exercise][walkthrough-previous], you utilized **ask mode** in GitHub Copilot. Ask mode is focused on "single-turn" operations, where you ask a question, receive an answer, and then repeat the flow as needed. Ask mode is great for generating individual files, learning about your project, and generic code-related questions.
2222

23-
**Agent mode** allows Copilot to act more like a peer programmer, both generating code suggestions and performing tasks on your behalf. Agent mode will explore your project, build an approach of how to resolve a problem, generate the code, perform supporting operations like running tests, and even self-heal should it find any problems.
23+
[**Agent mode**][agent-mode] allows Copilot to act like a peer programmer, both generating code suggestions and performing tasks on your behalf. Agent mode will explore your project, build an approach of how to resolve a problem, generate the code, perform supporting operations like running tests, and even self-heal should it find any problems.
24+
25+
> [!IMPORTANT]
26+
> Before Copilot agent mode runs any external commands it will ask for confirmation. This allows you to ensure it's doing the right thing, cancelling any incorrect operations.
2427
2528
By using agent mode, we'll be able to both create the code and tests, but have Copilot run the tests and correct any mistakes it might find.
2629

@@ -37,9 +40,40 @@ Let's ask Copilot to generate the code to add the feature and tests!
3740
Let's update the site to have an adoption status flag for the dogs! Create the necessary tests and ensure they all pass.
3841
```
3942

43+
> [!IMPORTANT]
44+
> Because AI is probabilistic rather than deterministic, the exact flow, code generated, and files changed will vary. We've highlighted a likely flow you'll experience with Copilot, but the specifics may be a bit different Copilot performs its tasks for you.
45+
>
46+
> The desired outcome is to have all tests passing, and the feature implemented. The exact code or look and feel are secondary to this goal.
47+
48+
5. Copilot agent mode gets to work on the project. You will notice it begins by exploring the project, determining what's already there, and coming up with a plan. It will then work on generating the necessary code and tests.
49+
6. As Copilot performs its operations, you'll occasionally be prompted by Copilot to execute commands to run the tests and other operations. Review the commands and, as appropriate, select **Continue**.
50+
7. Once Copilot completes its work, select **Keep** in the chat window to keep all files.
51+
52+
> [!NOTE]
53+
> There's always a chance Copilot may do the wrong thing or be unsuccessful at completing the task. While care was taken when building out the lab and scenario, mistakes can happen. If you get stuck, you can start new chat and request Copilot perform the task again, or consult with the workshop leader.
54+
55+
## Validating the changes
56+
57+
With the newly generated code in place, let's take a moment to ensure the site has the new behavior!
58+
59+
1. Open a terminal window in shell in your codespace by selecting <kbd>Ctl</kbd> + <kbd>Shift</kbd> + <kbd>\`</kbd>.
60+
2. Run the following command to start the site:
61+
62+
```shell
63+
./scripts/start-app.sh
64+
```
65+
66+
3. Once the output indicates the site has started, hold down <kbd>Cmd</kbd> (or <kbd>Ctl<kbd> on a PC) and click on the URL for `http://localhost:4321`.
67+
4. When page opens, view the updates, noticing the flag added.
68+
69+
> [!NOTE]
70+
> The exact look and feel may vary depending on the code Copilot generated.
71+
72+
5. Stop the site by returning to your codespace, clicking on the terminal window, and selecting <kbd>Ctl</kbd> + <kbd>C</kbd>.
73+
4074
## Summary and next steps
4175

42-
Congratulations! You've worked with GitHub Copilot to add new features to the website - the ability to filter the list of dogs. Let's close out by [creating a pull request with our new functionality][walkthrough-next]!
76+
Congratulations! You've worked with GitHub Copilot to a new flag to the site. Now it's time to take that feature and kickoff the rest of the DevOps flow. Let's close out by [creating a pull request with our new functionality][walkthrough-next]!
4377

4478
## Resources
4579

@@ -50,10 +84,12 @@ Congratulations! You've worked with GitHub Copilot to add new features to the we
5084
| [← Helping GitHub Copilot understand context][walkthrough-previous] | [Next: GitHub flow →][walkthrough-next] |
5185
|:-----------------------------------|------------------------------------------:|
5286

87+
[walkthrough-previous]: 5-context.md
88+
[walkthrough-next]: 7-github-flow.md
89+
[github-copilot]: https://docs.github.com/en/copilot/get-started/what-is-github-copilot
90+
[agents-in-sdlc]: https://github.com/github-samples/agents-in-sdlc
91+
[github-samples]: https://github.com/github-samples/
92+
[agent-mode]: https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode
5393
[copilot-chat-cookbook]: https://docs.github.com/en/copilot/copilot-chat-cookbook
5494
[copilot-chat-edits]: https://code.visualstudio.com/docs/copilot/copilot-edits
5595
[copilot-questions]: https://docs.github.com/en/copilot/using-github-copilot/copilot-chat/asking-github-copilot-questions-in-your-ide
56-
[localhost]: http://localhost:4321
57-
[localhost-breeds]: http://localhost:5100/api/breeds
58-
[walkthrough-previous]: 5-context.md
59-
[walkthrough-next]: 7-github-flow.md

0 commit comments

Comments
 (0)