Skip to content

feat: Clarify step 4 steps are optional #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions .github/steps/4-copilot-on-github.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
## Step 4: Using GitHub Copilot within a pull request

Congratulations! You are finished with coding for this exercise :tada:
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!

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

### :keyboard: Activity: Summarize and review with Copilot :robot:
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!

1. In a web browser, navigate to your exercise repository.
> [!NOTE]
> 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)

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.
#### Copilot Review

- **base:** `main`
- **compare:** `accelerate-with-copilot`
- **title:** `Add registration validation and more activities`
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.

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:
> [!IMPORTANT]
> This is in **Public Preview** for organizations. [[docs]](https://docs.github.com/en/copilot/using-github-copilot/code-review/using-copilot-code-review)

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**.
### :keyboard: Activity: Summarize and review a PR with Copilot

1. Below the pull request description, press the green **Create pull request** one more time.
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.

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

- Notice the log entry indicating a Copilot review was requested.
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:

1. Wait a moment for Mona to check your work, provide feedback, and post a final review of this lesson!
- **base:** `main`
- **compare:** `accelerate-with-copilot`
- **title:** `Add registration validation and more activities`

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:

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

<details>
<summary>Having trouble? 🤷</summary><br/>
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!

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

- Make sure Copilot generated a description.
- Make sure Copilot was requested to provide a review.
> **Tip:** Notice a log entry that Copilot was requested for a review.

</details>
1. At the bottom, press the **Merge pull request** button. Nice work! You are all done! :tada:

1. Wait a moment for Mona to check your work, provide feedback, and post a final review of this lesson!
3 changes: 2 additions & 1 deletion .github/workflows/3-copilot-edits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ jobs:
- name: Disable current workflow and enable next one
run: |
gh workflow disable "Step 3"
gh workflow enable "Step 4"
gh workflow enable "Step 4a"
gh workflow enable "Step 4b"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
171 changes: 171 additions & 0 deletions .github/workflows/4a-copilot-on-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Step 4a # Copilot on GitHub

on:
pull_request:
branches:
- main
types:
- closed

permissions:
contents: write
actions: write
issues: write

env:
REVIEW_FILE: ".github/steps/x-review.md"

jobs:
find_exercise:
if: |
!github.event.repository.is_template
name: Find exercise by issue title
runs-on: ubuntu-latest

outputs:
issue-url: ${{ steps.get-issue-url.outputs.ISSUE_URL }}

steps:
- id: get-issue-url
run: |
# Get the issue url from the event or search for it.
if [ -n "${{ github.event.issue }}" ]; then
issue_url="${{ github.event.issue.html_url }}"
else
issue_url=$(gh issue list --repo $REPO --search "in:title Exercise:" --json url,title --jq '.[].url')
fi

# Save to output
echo "ISSUE_URL=$issue_url" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}

check_step_work:
name: Check step work
runs-on: ubuntu-latest
needs: [find_exercise]
env:
ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get response templates
uses: actions/checkout@v4
with:
repository: skills/response-templates
path: skills-response-templates

# START: Check practical exercise

# Nothing to check. Merging the pull request is enough.

# END: Check practical exercise

- name: Create comment - step finished - final review next
run: |
gh issue comment "$ISSUE_URL" \
--body-file skills-response-templates/step-feedback/lesson-review.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

post_review_content:
name: Post review content
needs: [find_exercise, check_step_work]
runs-on: ubuntu-latest
env:
ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get response templates
uses: actions/checkout@v4
with:
repository: skills/response-templates
path: skills-response-templates

- name: Create comment - add step content
run: |
gh issue comment "$ISSUE_URL" \
--body-file "$REVIEW_FILE"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

finish_exercise:
name: Finish exercise
needs: [find_exercise, post_review_content]
runs-on: ubuntu-latest
env:
ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main

- name: Get response templates
uses: actions/checkout@v4
with:
repository: skills/response-templates
path: skills-response-templates

- name: Configure Git user
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com

- name: Build message - congratulations
id: build-message-congratulations
uses: skills/action-text-variables@v1
with:
template-file: skills-response-templates/readme/congratulations.md
template-vars: |
login=${{ github.actor }}

- name: Update README - congratulations
run: |
# Add "Congratulations" to the start of the README
orig_readme=$(cat README.md)
new_readme="${{ steps.build-message-congratulations.outputs.updated-text }} $orig_readme"

# Update file and push
echo "$new_readme" > README.md
git add README.md
git commit --message="Congratulations!🎉"
git push
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build message - exercise finished
id: build-finish-message
uses: skills/action-text-variables@v1
with:
template-file: skills-response-templates/step-feedback/lesson-finished.md
template-vars: |
login=${{ github.actor }}
repo_full_name=${{ github.repository }}

- name: Create comment - exercise finished
run: |
gh issue comment "$ISSUE_URL" \
--body "$ISSUE_BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_BODY: ${{ steps.build-finish-message.outputs.updated-text }}

- name: Close issue
run: gh issue close "$ISSUE_URL"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Disable current workflow
run: |
gh workflow disable "Step 4a"
gh workflow disable "Step 4b"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading