Skip to content

Commit 603975e

Browse files
authored
feat: Clarify step 4 steps are optional (#8)
1 parent 6a53dae commit 603975e

File tree

4 files changed

+210
-145
lines changed

4 files changed

+210
-145
lines changed

.github/steps/4-copilot-on-github.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
11
## Step 4: Using GitHub Copilot within a pull request
22

3-
Congratulations! You are finished with coding for this exercise :tada:
3+
Congratulations! You are finished with coding for this exercise. Now it's time to merge our work. :tada: To wrap up, let's learn about two limited-access Copilot features that can speed up our pull requests!
44

5-
Now, let's see how Copilot can help us finish up with during our pull request.
5+
#### Copilot Pull Request Summaries
66

7-
### :keyboard: Activity: Summarize and review with Copilot :robot:
7+
Typically, you would review your notes and commit messages then summarize them for your pull request description. This may take some time, especially if commit messages are inconsistent or code is not not documented well. Fortunately, Copilot can consider all changes in the pull request and provide the important highlights, and with references too!
88

9-
1. In a web browser, navigate to your exercise repository.
9+
> [!NOTE]
10+
> This is a unavailable with the **Copilot Free** tier. [[docs]](https://docs.github.com/en/enterprise-cloud@latest/copilot/using-github-copilot/using-github-copilot-for-pull-requests/creating-a-pull-request-summary-with-github-copilot)
1011
11-
1. At the top, select the **Pull Requests** tab and create a new pull request. Stop when you reach a form to enter a title and description.
12+
#### Copilot Review
1213

13-
- **base:** `main`
14-
- **compare:** `accelerate-with-copilot`
15-
- **title:** `Add registration validation and more activities`
14+
More eyes on our work is always useful so let's ask Copilot to do a first pass before we do a normal peer review process. Copilot is great at catching common mistakes that can are fixed by simple adjustment, but please remember to use it responsibily.
1615

17-
1. **Use Copilot to add a description** - In the **Add a description** toolbar, click the **Copilot actions** icon and **Summary** action to describe your changes. :memo:
16+
> [!IMPORTANT]
17+
> This is in **Public Preview** for organizations. [[docs]](https://docs.github.com/en/copilot/using-github-copilot/code-review/using-copilot-code-review)
1818
19-
1. **Ask Copilot to review your changes** - In the right side information panel at the top, locate the **Reviewers** section and click the **Request** button next to a **Copilot icon**.
19+
### :keyboard: Activity: Summarize and review a PR with Copilot
2020

21-
1. Below the pull request description, press the green **Create pull request** one more time.
21+
Both **pull request summaries** and **copilot review** have limited access, so this activity is mostly optional. If you have access, Mona will gladly check your work though! If not, you can skip the optional steps.
2222

23-
1. Wait a moment for Copilot to add a review comment to your pull request!
23+
1. In a web browser, open another tab and navigate to your exercise repository.
2424

25-
- Notice the log entry indicating a Copilot review was requested.
25+
1. You might notice a **notification banner** suggesting to create a new pull request. Click that or use the **Pull Requests** tab at the top to create a new pull request. Please use the following details:
2626

27-
1. Wait a moment for Mona to check your work, provide feedback, and post a final review of this lesson!
27+
- **base:** `main`
28+
- **compare:** `accelerate-with-copilot`
29+
- **title:** `Add registration validation and more activities`
30+
31+
1. (Optional) In the **Add a description** area, enter edit mode if needed, then click the **Copilot actions** icon and **Summary** action. After a moment, Copilot will add a description. :memo:
2832

29-
1. At the bottom, press the green **Merge pull request** button. Nice work! You are all done! :tada:
33+
<img alt="Copilot summarize button " width="300px" src="https://github.com/user-attachments/assets/3fc5fab4-db03-4ab8-8a16-cdd71ec2ded0">
3034

31-
<details>
32-
<summary>Having trouble? 🤷</summary><br/>
35+
1. (Optional) In the right side information panel at the top, locate the **Reviewers** section and click the **Request** button next to a **Copilot icon**. Wait a moment for Copilot to add a review comment to your pull request!
3336

34-
If you don't get feedback, here are some things to check:
37+
<img alt="Copilot review button" width="300px" src="https://github.com/user-attachments/assets/39b15002-a235-4c25-b09d-6a8097e27b62">
3538

36-
- Make sure Copilot generated a description.
37-
- Make sure Copilot was requested to provide a review.
39+
> **Tip:** Notice a log entry that Copilot was requested for a review.
3840
39-
</details>
41+
1. At the bottom, press the **Merge pull request** button. Nice work! You are all done! :tada:
42+
43+
1. Wait a moment for Mona to check your work, provide feedback, and post a final review of this lesson!

.github/workflows/3-copilot-edits.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ jobs:
204204
- name: Disable current workflow and enable next one
205205
run: |
206206
gh workflow disable "Step 3"
207-
gh workflow enable "Step 4"
207+
gh workflow enable "Step 4a"
208+
gh workflow enable "Step 4b"
208209
env:
209210
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: Step 4a # Copilot on GitHub
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- closed
9+
10+
permissions:
11+
contents: write
12+
actions: write
13+
issues: write
14+
15+
env:
16+
REVIEW_FILE: ".github/steps/x-review.md"
17+
18+
jobs:
19+
find_exercise:
20+
if: |
21+
!github.event.repository.is_template
22+
name: Find exercise by issue title
23+
runs-on: ubuntu-latest
24+
25+
outputs:
26+
issue-url: ${{ steps.get-issue-url.outputs.ISSUE_URL }}
27+
28+
steps:
29+
- id: get-issue-url
30+
run: |
31+
# Get the issue url from the event or search for it.
32+
if [ -n "${{ github.event.issue }}" ]; then
33+
issue_url="${{ github.event.issue.html_url }}"
34+
else
35+
issue_url=$(gh issue list --repo $REPO --search "in:title Exercise:" --json url,title --jq '.[].url')
36+
fi
37+
38+
# Save to output
39+
echo "ISSUE_URL=$issue_url" >> $GITHUB_OUTPUT
40+
env:
41+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
REPO: ${{ github.repository }}
43+
44+
check_step_work:
45+
name: Check step work
46+
runs-on: ubuntu-latest
47+
needs: [find_exercise]
48+
env:
49+
ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
50+
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
55+
- name: Get response templates
56+
uses: actions/checkout@v4
57+
with:
58+
repository: skills/response-templates
59+
path: skills-response-templates
60+
61+
# START: Check practical exercise
62+
63+
# Nothing to check. Merging the pull request is enough.
64+
65+
# END: Check practical exercise
66+
67+
- name: Create comment - step finished - final review next
68+
run: |
69+
gh issue comment "$ISSUE_URL" \
70+
--body-file skills-response-templates/step-feedback/lesson-review.md
71+
env:
72+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
post_review_content:
75+
name: Post review content
76+
needs: [find_exercise, check_step_work]
77+
runs-on: ubuntu-latest
78+
env:
79+
ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
80+
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v4
84+
85+
- name: Get response templates
86+
uses: actions/checkout@v4
87+
with:
88+
repository: skills/response-templates
89+
path: skills-response-templates
90+
91+
- name: Create comment - add step content
92+
run: |
93+
gh issue comment "$ISSUE_URL" \
94+
--body-file "$REVIEW_FILE"
95+
env:
96+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
98+
finish_exercise:
99+
name: Finish exercise
100+
needs: [find_exercise, post_review_content]
101+
runs-on: ubuntu-latest
102+
env:
103+
ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
104+
105+
steps:
106+
- name: Checkout
107+
uses: actions/checkout@v4
108+
with:
109+
ref: main
110+
111+
- name: Get response templates
112+
uses: actions/checkout@v4
113+
with:
114+
repository: skills/response-templates
115+
path: skills-response-templates
116+
117+
- name: Configure Git user
118+
run: |
119+
git config user.name github-actions[bot]
120+
git config user.email github-actions[bot]@users.noreply.github.com
121+
122+
- name: Build message - congratulations
123+
id: build-message-congratulations
124+
uses: skills/action-text-variables@v1
125+
with:
126+
template-file: skills-response-templates/readme/congratulations.md
127+
template-vars: |
128+
login=${{ github.actor }}
129+
130+
- name: Update README - congratulations
131+
run: |
132+
# Add "Congratulations" to the start of the README
133+
orig_readme=$(cat README.md)
134+
new_readme="${{ steps.build-message-congratulations.outputs.updated-text }} $orig_readme"
135+
136+
# Update file and push
137+
echo "$new_readme" > README.md
138+
git add README.md
139+
git commit --message="Congratulations!🎉"
140+
git push
141+
env:
142+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143+
144+
- name: Build message - exercise finished
145+
id: build-finish-message
146+
uses: skills/action-text-variables@v1
147+
with:
148+
template-file: skills-response-templates/step-feedback/lesson-finished.md
149+
template-vars: |
150+
login=${{ github.actor }}
151+
repo_full_name=${{ github.repository }}
152+
153+
- name: Create comment - exercise finished
154+
run: |
155+
gh issue comment "$ISSUE_URL" \
156+
--body "$ISSUE_BODY"
157+
env:
158+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159+
ISSUE_BODY: ${{ steps.build-finish-message.outputs.updated-text }}
160+
161+
- name: Close issue
162+
run: gh issue close "$ISSUE_URL"
163+
env:
164+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165+
166+
- name: Disable current workflow
167+
run: |
168+
gh workflow disable "Step 4a"
169+
gh workflow disable "Step 4b"
170+
env:
171+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)