Skip to content

Commit

Permalink
Ask learner to create PR manually and add permissions (#18)
Browse files Browse the repository at this point in the history
* Remove PR creation from 0-start.yml

* Ask learner to manually create PR

* More PR wording changes

* Add `package: write` `permission` to publish workflow
  • Loading branch information
chadfawcett authored Feb 16, 2023
1 parent ce229b3 commit 7e3731f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/0-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ on:
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 from .github/script/STEP so we can
Expand Down Expand Up @@ -58,8 +56,8 @@ jobs:
with:
fetch-depth: 0 # Let's get all the branches

# Make a branch, commit, and pull request for the learner
- name: Prepare a branch and pull request
# Make a branch, and commit for the learner
- name: Prepare a branch
run: |
echo "Make sure we are on step 0"
if [ "$(cat .github/script/STEP)" != 0 ]
Expand All @@ -79,11 +77,7 @@ jobs:
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 "Publish to Docker with Actions" --body "Publish to Docker with Actions"
echo "Restore main"
git checkout main
env:
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,19 @@ We'll start by creating the workflow file to publish a Docker image to GitHub Pa
### :keyboard: Activity: Create the workflow file

1. Open a new browser tab, and work on the steps in your second tab while you read the instructions in this tab.
1. Open the pull request I made for you from the `cd` branch.
1. Add a new file at `.github/workflows/publish.yml`.
1. Navigate to the **Code** tab.
1. From the **main** branch dropdown, click on the **cd** branch.
1. Navigate to the `.github/workflows/` folder, then select **Add file** and click on **Create new file**.
1. In the **Name your file...** field, enter `publish.yml`.
1. Add the following to the `publish.yml` file:
```yml
name: Publish to Docker
on:
push:
branches:
- main
permissions:
packages: write
jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -94,6 +98,7 @@ We'll start by creating the workflow file to publish a Docker image to GitHub Pa
```
1. Replace `YOURNAME` with your username.
1. Commit your changes.
1. (optional) Create a pull request to view all the changes you'll make throughout this course. Click the **Pull Requests** tab, click **New pull request**, set `base: main` and `compare:cd`.
1. Wait about 20 seconds then refresh this page for the next step.

</details>
Expand All @@ -109,7 +114,7 @@ We'll start by creating the workflow file to publish a Docker image to GitHub Pa

_You created a publishing workflow! :tada:_

We will add a `Dockerfile` in this pull request. The `Dockerfile` contains a set of instructions that get stored in a `Docker Image`. If you'd like, you can [learn more about Dockerfiles](https://docs.docker.com/engine/reference/builder/).
We will add a `Dockerfile` to the `cd` branch. The `Dockerfile` contains a set of instructions that get stored in a `Docker Image`. If you'd like, you can [learn more about Dockerfiles](https://docs.docker.com/engine/reference/builder/).

### :keyboard: Activity: Add a Dockerfile

Expand All @@ -130,16 +135,16 @@ We will add a `Dockerfile` in this pull request. The `Dockerfile` contains a set
-->

<details id=3>
<summary><h2>Step 3: Merge your pull request</h2></summary>
<summary><h2>Step 3: Merge your changes</h2></summary>

_Let's get publishing! :heart:_

You can now [merge](https://docs.github.com/en/get-started/quickstart/github-glossary#merge) your pull request!
You can now [merge](https://docs.github.com/en/get-started/quickstart/github-glossary#merge) your changes!

### :keyboard: Activity: Merge your pull request
### :keyboard: Activity: Merge your changes

1. Click **Merge pull request**.
1. Delete the branch `cd` (optional).
1. Merge your changes from `cd` into `main`. If you created the pull request in step 1, just open that PR and click on **Merge pull request**. If you did not create the pull request earlier, you can do it now by following the instructions in step 1.
1. (optional) Delete the branch `my-pages`.
1. Wait about 20 seconds then refresh this page for the next step.

</details>
Expand Down

0 comments on commit 7e3731f

Please sign in to comment.