Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #15 from githubtraining/add-cli-pref
Browse files Browse the repository at this point in the history
WIP: Add a CLI course pref
  • Loading branch information
hectorsector authored Dec 5, 2018
2 parents c56afc0 + 2455e7e commit 28de1df
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 21 deletions.
36 changes: 26 additions & 10 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ template:
name: "github-slideshow"
repo: "caption-this-template"
description: "A robot powered training repository :robot:"
preferences:
- type: radio
name: gitTool
label: Preferred Git tool
description: Learn right from the web UI, or using your chosen tool
options:
- label: Use the GitHub.com web interface
value: dotcom
- label: Use the command line
value: cli
before:
- type: updateBranchProtection
- type: createIssue
Expand Down Expand Up @@ -34,21 +44,23 @@ steps:
issue: "Getting Started with GitHub"
with: "close-issue.md"

- title: "Close an issue"
description: "Cease a conversation by closing an issue."
event: "issues.closed"
- title: Close an issue
description: Cease a conversation by closing an issue.
event: issues.closed
link: https://github.com/{{ user.username }}/{{ course.template.name }}/issues/1
actions:
- type: createIssue
action_id: contrib_issue
title: "Your first contribution"
body: "your-first-contribution.md"
title: Your first contribution
body: your-first-contribution.md
comments:
- "create-a-branch.md"
- create-a-branch.md
data:
thePayload: '%payload%'
- type: respond
with: "head-to-branch.md"
with: head-to-branch.md
data:
issueURL: "%actions.contrib_issue.data.html_url%"
issueURL: '%actions.contrib_issue.data.html_url%'

- title: "Create a branch"
description: "Create a branch for introducing new changes."
Expand All @@ -57,9 +69,9 @@ steps:
actions:
- type: respond
issue: "Your first contribution"
with: "commit-something.md"
with: commit-something.md
data:
branch: "%payload.ref%"
thePayload: '%payload%'

- title: "Commit a file"
description: "Commit your file to the branch."
Expand Down Expand Up @@ -125,6 +137,8 @@ steps:
- type: createReview
body: request-changes.md
event: 'COMMENT'
data:
branch: '%payload.pull_request.head.ref%'


- title: "Respond to a review"
Expand Down Expand Up @@ -156,6 +170,8 @@ steps:
- type: createReview
body: pr-succeeds.md
event: APPROVE
data:
branch: '%payload.pull_request.head.ref%'

- title: "Merge your pull request"
description: "Make your changes live by merging your PR."
Expand Down
49 changes: 38 additions & 11 deletions responses/commit-something.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,49 @@ In the first field, type a commit message. The commit message should briefly tel

The following steps will guide you through the process of committing a change on GitHub.

{% if preferences.gitTool == 'cli' %}
1. Check out to your branch:
```shell
git checkout {{ thePayload.ref }}
```
1. Create a new file named `_posts/0000-01-02-{{ user.username }}.md`.
1. Add the following content to your file:
```yaml
---
layout: slide
title: "Welcome to our second slide!"
---
Your text
Use the left arrow to go back!
```
1. Stage your new file:
```shell
git add _posts/0000-01-02-{{ user.username }}.md
```
1. After adding the text, commit the change and a commit message, check out the **Commits 101** drop-down, just above these instructions:
```shell
git commit -m "<YOUR-MESSAGE>"
```
1. Push your new commit to GitHub:
```shell
git push
```
{% else %}
1. Return to the "Code" tab
1. In the branch drop-down, select "{{ branch }}"
1. In the branch drop-down, select "{{ thePayload.ref }}"
1. Click **Create new file**
1. In the "file name" field, type `_posts/0000-01-02-{{ user.username }}.md`
1. When you’re done naming the file, add the following content to your file:

---
layout: slide
title: "Welcome to our second slide!"
---
Your text
Use the left arrow to go back!


```yaml
---
layout: slide
title: "Welcome to our second slide!"
---
Your text
Use the left arrow to go back!
```
1. After adding the text, you can commit the change by entering a commit message in the text-entry field below the file edit view. For guidelines on commit messages, check out the **Commits 101** drop-down, just above these instructions
1. When you’ve entered a commit message, click **Commit new file**

{% endif %}
<hr>
<h3 align="center">Return to this issue for my response</h3>
21 changes: 21 additions & 0 deletions responses/create-a-branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,31 @@ The best way to keep branches organized with a team is to keep them concise and

### :keyboard: Activity: Your first branch

{% if preferences.gitTool == 'cli' %}
1. Open your preferred command line interface, which we'll call your shell from now on.
1. Clone this repository:
```shell
git clone {{ thePayload.repository.clone_url }}
```
1. Navigate to the repository in your shell:
```shell
cd {{ thePayload.repository.name }}
```
1. Create a branch, use whatever name you like:
```shell
git branch <BRANCH-NAME>
```
1. Push the branch to GitHub:
```
git push --set-upstream origin <BRANCH-NAME>
```
{% else %}

1. Navigate to the “Code” tab
2. Click **Branch: master** in the drop-down
3. In the field, enter a name for your branch
4. Click **Create branch: <name>** or press the “Enter” key to create your branch

{% endif %}
<hr>
<h3 align="center">Return to this issue for my response</h3>
19 changes: 19 additions & 0 deletions responses/pr-succeeds.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,27 @@ You successfully created a pull request, and it has passed all of the tests. You

### :keyboard: Activity: Merge the pull request

{% if preferences.gitTool == 'cli' %}
1. Check out to the `master` branch:
```shell
git checkout master
```
2. Merge your branch:
```shell
git merge {{ branch }}
```
3. Push the merged history to GitHub:
```shell
git push
```
4. Delete your the branch locally:
```shell
git branch -d {{ branch }}
```
{% else %}
1. Click **Merge pull request**
1. Click **Confirm merge**
{% endif %}
1. Once your branch has been merged, you don't need it anymore. Click **Delete branch**.
<hr>
Expand Down
21 changes: 21 additions & 0 deletions responses/request-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,31 @@ Let’s add some content to your file. Replace line 5 of your file with a quotat

### :keyboard: Activity: Change your file

{% if preferences.gitTool == 'cli' %}
1. Check out to your branch:
```shell
git checkout {{ branch }}
```
1. Open the file `_posts/0000-01-02-{{ user.username }}.md`.
1. Replace line 5 of the file with something new.
1. Stage your new changes:
```shell
git add _posts/0000-01-02-{{ user.username }}.md
```
1. Commit your changes:
```shell
git commit -m "<YOUR-MESSAGE>"
```
1. Push your edits to GitHub:
```shell
git push
```
{% else %}
1. Click the "Files Changed" tab in this pull request
1. Click on the pencil icon found on the right side of the screen
1. Replace line 5 with something new
1. Scroll to the bottom and click **Commit Changes**
{% endif %}

<hr>
<h3 align="center">Watch below for my response</h3>

0 comments on commit 28de1df

Please sign in to comment.