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
bowen xiao
committed
Sep 8, 2022
0 parents
commit 73d767f
Showing
11 changed files
with
1,150 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 @@ | ||
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,86 @@ | ||
name: Step 0, Start | ||
|
||
# This step triggers after the learner creates a new repository from the template | ||
# This step sets STEP to 1 | ||
# This step closes <details id=0> and opens <details id=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: | ||
on_start: | ||
name: On start | ||
|
||
# We will only run this action when: | ||
# 1. This repository isn't the template repository | ||
# 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 }} | ||
|
||
# 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@v2 | ||
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/script/STEP)" != 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 | ||
git config user.email [email protected] | ||
git add index.html | ||
git commit --message="Update game over message" | ||
echo "Push" | ||
git push --set-upstream origin $BRANCH | ||
echo "Make a pull request" | ||
# Reference https://cli.github.com/manual/gh_pr_create | ||
gh pr create --title "Update the game over message" --body "Update the game over message so people know how to play again!" | ||
echo "Restore main" | ||
git checkout main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Update README to close <details id=0> and open <details id=1> | ||
# and set STEP to '1' | ||
- name: Update to step 1 | ||
uses: skills/action-update-step@v1 | ||
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,50 @@ | ||
name: Step 1, Assign yourself | ||
|
||
# This step triggers after the user assigns themselves as a pull request reviewer | ||
# This step sets STEP to 2 | ||
# This step closes <details id=1> and opens <details id=2> | ||
|
||
# This will run every time someone is assigned as a pull request reviewer | ||
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: | ||
- review_requested | ||
|
||
# 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: | ||
on_assigned_reviewer: | ||
name: On assigned reviewer | ||
|
||
# We will only run this action when: | ||
# 1. This repository isn't the template repository | ||
# 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 }} | ||
|
||
# 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@v2 | ||
with: | ||
fetch-depth: 0 # Let's get all the branches | ||
ref: update-game | ||
|
||
# Update README to close <details id=1> and open <details id=2> | ||
# and set STEP to '2' | ||
- name: Update to step 2 | ||
uses: skills/action-update-step@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
from_step: 1 | ||
to_step: 2 | ||
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,50 @@ | ||
name: Step 2, Leave a review | ||
|
||
# This step triggers after the user leaves a pull request review | ||
# This step sets STEP to 3 | ||
# This step closes <details id=2> and opens <details id=3> | ||
|
||
# This will run every time we leave a pull request review | ||
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
workflow_dispatch: | ||
pull_request_review: | ||
types: | ||
- submitted | ||
|
||
# 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: | ||
on_leave_review: | ||
name: On leave review | ||
|
||
# We will only run this action when: | ||
# 1. This repository isn't the template repository | ||
# 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 }} | ||
|
||
# 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@v2 | ||
with: | ||
fetch-depth: 0 # Let's get all the branches | ||
ref: update-game | ||
|
||
# Update README to close <details id=2> and open <details id=3> | ||
# and set STEP to '3' | ||
- name: Update to step 3 | ||
uses: skills/action-update-step@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
from_step: 2 | ||
to_step: 3 | ||
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,50 @@ | ||
name: Step 3, Suggest changes | ||
|
||
# This step triggers after the user leaves a review comment | ||
# This step sets STEP to 4 | ||
# This step closes <details id=3> and opens <details id=4> | ||
|
||
# This will run every time we leave a review comment | ||
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
workflow_dispatch: | ||
pull_request_review_comment: | ||
types: | ||
- created | ||
|
||
# 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: | ||
on_review_comment: | ||
name: On review comment | ||
|
||
# We will only run this action when: | ||
# 1. This repository isn't the template repository | ||
# 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 }} | ||
|
||
# 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@v2 | ||
with: | ||
fetch-depth: 0 # Let's get all the branches | ||
ref: update-game | ||
|
||
# Update README to close <details id=3> and open <details id=4> | ||
# and set STEP to '4' | ||
- name: Update to step 4 | ||
uses: skills/action-update-step@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
from_step: 3 | ||
to_step: 4 | ||
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,50 @@ | ||
name: Step 4, Apply changes | ||
|
||
# This step triggers after the user applies the pull request suggested change | ||
# This step sets STEP to 5 | ||
# This step closes <details id=4> and opens <details id=5> | ||
|
||
# This will run every time we push to the `update-game branch` | ||
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- update-game | ||
|
||
# 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: | ||
on_apply_suggested_change: | ||
name: On apply suggested change | ||
|
||
# We will only run this action when: | ||
# 1. This repository isn't the template repository | ||
# 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 }} | ||
|
||
# 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@v2 | ||
with: | ||
fetch-depth: 0 # Let's get all the branches | ||
ref: update-game | ||
|
||
# Update README to close <details id=4> and open <details id=5> | ||
# and set STEP to '5' | ||
- name: Update to step 5 | ||
uses: skills/action-update-step@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
from_step: 4 | ||
to_step: 5 | ||
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,49 @@ | ||
name: Step 5, Merge your pull request | ||
|
||
# This step triggers after a pull requst is merged to `main` | ||
# This step sets STEP to X | ||
# This step closes <details id=5> and opens <details id=X> | ||
|
||
# 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 | ||
contents: write | ||
|
||
jobs: | ||
on_merge: | ||
name: On merge | ||
|
||
# We will only run this action when: | ||
# 1. This repository isn't the template repository | ||
# 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 }} | ||
|
||
# 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@v2 | ||
with: | ||
fetch-depth: 0 # Let's get all the branches | ||
|
||
# Update README to close <details id=5> and open <details id=X> | ||
# and set STEP to 'X' | ||
- name: Update to step X | ||
uses: skills/action-update-step@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
from_step: 5 | ||
to_step: X | ||
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,37 @@ | ||
# Compiled source # | ||
################### | ||
*.com | ||
*.class | ||
*.dll | ||
*.exe | ||
*.o | ||
*.so | ||
|
||
# Packages # | ||
############ | ||
# it's better to unpack these files and commit the raw source | ||
# git has its own built in compression methods | ||
*.7z | ||
*.dmg | ||
*.gz | ||
*.iso | ||
*.jar | ||
*.rar | ||
*.tar | ||
*.zip | ||
|
||
# Logs and databases # | ||
###################### | ||
*.log | ||
*.sql | ||
*.sqlite | ||
|
||
# OS generated files # | ||
###################### | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db |
Oops, something went wrong.