generated from skills/review-pull-requests
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 750b2e8
Showing
21 changed files
with
948 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!-- readme --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- | ||
<<< Author notes: Step 1 >>> | ||
Choose 3-5 steps for your course. | ||
The first step is always the hardest, so pick something easy! | ||
Link to docs.github.com for further explanations. | ||
Encourage users to open new tabs for steps! | ||
--> | ||
|
||
## Step 1: Open a pull request | ||
|
||
_Welcome to "Review pull requests"! :wave:_ | ||
|
||
Let's get started by opening a pull request. | ||
|
||
**What is a pull request?**: Collaboration happens on a pull request. The pull request shows the changes in your branch to other people. This pull request is going to keep the changes you just made on your branch and propose applying them to the `main` branch. | ||
|
||
### :keyboard: Activity: Create a pull request | ||
|
||
1. Click on the **Pull requests** tab in your repository. | ||
2. Click **New pull request**. | ||
3. In the **base:** dropdown, make sure **main** is selected. | ||
4. Select the **compare:** dropdown, and click `update-game`. | ||
5. Click **Create pull request**. | ||
6. Enter a title for your pull request: `Update the game over message`. | ||
7. Enter a description for your pull request: `Update the game over message so people know how to play again!` | ||
8. Click **Create pull request**. | ||
9. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- | ||
<<< Author notes: Step 2 >>> | ||
Start this step by acknowledging the previous step. | ||
Define terms and link to docs.github.com. | ||
Historic note: this step combines the commend, approve, and needs changes steps from the previous version. | ||
--> | ||
|
||
## Step 2: Assign yourself | ||
|
||
_Great job opening that pull request! :wave:_ | ||
|
||
**What is a _pull request review_?**: Reviewing a pull request is an opportunity to examine another contributor's changes and give them feedback. It's an awesome opportunity to learn more about how the project works and how others solve problems. | ||
|
||
The best way to get a review is to ask for one. On GitHub, you can ask someone to review a pull request by assigning them as a reviewer or assignee. If you are not ready for review, consider [creating a draft pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) instead. | ||
|
||
### :keyboard: Activity: Assign yourself | ||
|
||
1. Open the pull request you just created. | ||
1. Under **Assignees** on the right side of the screen, add yourself. | ||
|
||
Because you created the pull request, you can't assign yourself as a reviewer, but feel free to assign a friend as a reviewer instead to see how it works :smile: | ||
|
||
1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!-- | ||
<<< Author notes: Step 3 >>> | ||
Start this step by acknowledging the previous step. | ||
Define terms and link to docs.github.com. | ||
Historic note: this step combines the commend, approve, and needs changes steps from the previous version. | ||
--> | ||
|
||
## Step 3: Leave a review | ||
|
||
_You assigned yourself! :tada:_ | ||
|
||
Pull request reviews ensure quality and maintain momentum of changes to your project. | ||
|
||
#### When reviewing a pull request: | ||
|
||
1. Review the _title_ and _body_ of the pull request, and possibly any associated issue, to understand the intended change. | ||
1. Review the [diff](https://docs.github.com/en/get-started/quickstart/github-glossary#diff), the comparison of the proposed code, in the context of the whole project. | ||
1. For most things, try out the proposed change. Check if the actual change matches the intention. Find the repository's [contributing guide](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors) to find out how to review the changes. | ||
|
||
#### In your review comments: | ||
|
||
- Identify potential issues, risks, and limitations. | ||
- Suggest changes and improvements. | ||
- Share awareness of upcoming changes that the pull request doesn't account for. | ||
- Ask questions to verify shared understanding. | ||
- Highlight what the author did well and should keep doing. | ||
- Prioritize the most important feedback. | ||
- Be concise _and_ provide meaningful detail. | ||
- Treat the pull request author with kindness and empathy. | ||
|
||
When an approval or request for changes is not yet needed, consider using **comments**. An **approval** lets the author know you believe the pull request is safe to merge. **Requesting changes** lets the author know you believe the pull request is not ready to merge. | ||
|
||
### :keyboard: Activity: Leave a review | ||
|
||
1. On the pull request, click **Files changed**. | ||
1. Click **Review changes**. | ||
1. Add a comment with your initial thoughts on the pull request. | ||
1. Select _comment_. You won't be able to _approve_ or _request changes_ to your own pull request. | ||
1. Click **Submit review**. | ||
1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- | ||
<<< Author notes: Step 4 >>> | ||
Start this step by acknowledging the previous step. | ||
Define terms and link to docs.github.com. | ||
--> | ||
|
||
## Step 4: Suggest changes | ||
|
||
_Nice work reviewing that pull request :sparkles:_ | ||
|
||
Now that you have explored the different ways you can review a pull request it is time to learn how to use _suggest changes_. | ||
|
||
**What is _suggest changes_?**: This feature enables you to recommend a change to a pull request that the author can commit with the push of a button. | ||
|
||
### :keyboard: Activity: Suggest changes | ||
|
||
1. On the pull request, click **Files changed**. | ||
1. Find the `index.html` changes. | ||
1. Hover your cursor next to the line numbers on the left side of the page. | ||
1. Click the blue plus icon. | ||
1. After the comment form appears, click the **Add a suggestion** button. <br> | ||
![add-a-suggestion-button](https://user-images.githubusercontent.com/97056108/184449714-61e8ee51-824a-48c1-9436-2dfd67f2c070.png) | ||
1. Edit the suggestion. | ||
1. Click **Add a single comment**. | ||
1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!-- | ||
<<< Author notes: Step 5 >>> | ||
Start this step by acknowledging the previous step. | ||
Define terms and link to docs.github.com. | ||
--> | ||
|
||
## Step 5: Apply suggested changes | ||
|
||
_Nicely done suggesting changes! :partying_face:_ | ||
|
||
Now let's see how easy it is to [apply your suggestion](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request). | ||
|
||
### :keyboard: Activity: Apply suggested changes | ||
|
||
1. Click **Commit suggestion**. | ||
1. Type a commit message. | ||
1. Click **Commit changes**. | ||
1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- | ||
<<< Author notes: Step 6 >>> | ||
Start this step by acknowledging the previous step. | ||
Define terms and link to docs.github.com. | ||
--> | ||
|
||
## Step 6: Merge your pull request | ||
|
||
_Almost there! :heart:_ | ||
|
||
You can now [merge](https://docs.github.com/en/get-started/quickstart/github-glossary#merge) your pull request! | ||
|
||
### :keyboard: Activity: Merge your pull request | ||
|
||
1. Click **Merge pull request**. | ||
1. Delete the branch `update-game` (optional). | ||
1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- | ||
<<< Author notes: Finish >>> | ||
Review what we learned, ask for feedback, provide next steps. | ||
--> | ||
|
||
## Finish | ||
|
||
_Congratulations friend, you've completed this course!_ | ||
|
||
<img src=https://octodex.github.com/images/hula_loop_octodex03.gif alt=celebrate width=300 align=right> | ||
|
||
As you continue working on GitHub, remember that high quality reviews improve your projects. If you are new to a repository, inquire about what review practices they have so you can hit the ground running. | ||
|
||
Here's a recap of all the tasks you've accomplished in your repository: | ||
|
||
- You learned how to assign pull requests for review. | ||
- You left a review on a pull request. | ||
- You suggested changes to a pull request. | ||
- You applied suggested changes to a pull request. | ||
|
||
### What's next? | ||
|
||
- Try adding a [`CODEOWNERS`](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners) file to your project to automatically assign reviewers to pull requests. | ||
- We'd love to hear what you thought of this course [in our discussion board](https://github.com/orgs/skills/discussions/categories/review-pull-requests). | ||
- [Take another GitHub Skills course](https://github.com/skills). | ||
- [Read the GitHub Getting Started docs](https://docs.github.com/en/get-started). | ||
- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Step 0, Welcome | ||
|
||
# This step triggers after the learner creates a new repository from the template. | ||
# This workflow updates from step 0 to step 1. | ||
|
||
# This will run every time we create push a commit to `main`. | ||
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication | ||
permissions: | ||
# Need `contents: read` to checkout the repository. | ||
# Need `contents: write` to update the step metadata. | ||
# Need `pull-requests: write` to create a pull request. | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
# Get the current step to only run the main job when the learner is on the same step. | ||
get_current_step: | ||
name: Check current step number | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- id: get_step | ||
run: | | ||
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT | ||
outputs: | ||
current_step: ${{ steps.get_step.outputs.current_step }} | ||
|
||
on_start: | ||
name: On start | ||
needs: get_current_step | ||
|
||
# We will only run this action when: | ||
# 1. This repository isn't the template repository. | ||
# 2. The step is currently 0. | ||
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts | ||
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions | ||
if: >- | ||
${{ !github.event.repository.is_template | ||
&& needs.get_current_step.outputs.current_step == 0 }} | ||
# We'll run Ubuntu for performance instead of Mac or Windows. | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# We'll need to check out the repository so that we can edit the README. | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Let's get all the branches. | ||
|
||
# Create update-game branch, update game, and create pull request for the learner. | ||
- name: Prepare a branch and pull request | ||
run: | | ||
echo "Make sure we are on step 0" | ||
if [ "$(cat .github/steps/-step.txt)" != 0 ] | ||
then | ||
echo "Current step is not 0" | ||
exit 0 | ||
fi | ||
echo "Make a branch" | ||
BRANCH=update-game | ||
git checkout -b $BRANCH | ||
echo "Update index.html" | ||
sed -i.bak 's/Game over/Game over, refresh to play again 🧑💻 🤖!/' index.html | ||
echo "Make a commit" | ||
git config user.name github-actions[bot] | ||
git config user.email github-actions[bot]@users.noreply.github.com | ||
git add index.html | ||
git commit --message="Update game over message" | ||
echo "Push" | ||
git push --set-upstream origin $BRANCH | ||
echo "Restore main" | ||
git checkout main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# In README.md, switch step 0 for step 1. | ||
- name: Update to step 1 | ||
uses: skills/action-update-step@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
from_step: 0 | ||
to_step: 1 | ||
branch_name: update-game |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Step 1, Open a pull request | ||
|
||
# This step listens for the learner to open a pull request with branch `update-game`. | ||
# This workflow updates from step 1 to step 2. | ||
|
||
# This will run every time we create a branch or tag. | ||
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
|
||
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication | ||
permissions: | ||
# Need `contents: read` to checkout the repository. | ||
# Need `contents: write` to update the step metadata. | ||
contents: write | ||
|
||
jobs: | ||
# Get the current step to only run the main job when the learner is on the same step. | ||
get_current_step: | ||
name: Check current step number | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- id: get_step | ||
run: | | ||
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT | ||
outputs: | ||
current_step: ${{ steps.get_step.outputs.current_step }} | ||
|
||
on_open_a_pull_request: | ||
name: On open a pull request | ||
needs: get_current_step | ||
|
||
# We will only run this action when: | ||
# 1. This repository isn't the template repository. | ||
# 2. The step is currently 1. | ||
# 3. The head branch name is `update-game`. | ||
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts | ||
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions | ||
if: >- | ||
${{ !github.event.repository.is_template | ||
&& needs.get_current_step.outputs.current_step == 1 | ||
&& github.head_ref == 'update-game' }} | ||
# We'll run Ubuntu for performance instead of Mac or Windows. | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# We'll need to check out the repository so that we can edit the README. | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Let's get all the branches. | ||
ref: update-game # Important, as normally `pull_request` event won't grab other branches. | ||
|
||
# In README.md, switch step 1 for step 2. | ||
- name: Update to step 2 | ||
uses: skills/action-update-step@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
from_step: 1 | ||
to_step: 2 | ||
branch_name: update-game |
Oops, something went wrong.