diff --git a/config.yml b/config.yml index f737f25..c7e60a6 100644 --- a/config.yml +++ b/config.yml @@ -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 @@ -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." @@ -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." @@ -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" @@ -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." diff --git a/responses/commit-something.md b/responses/commit-something.md index 56f5b83..22b3911 100644 --- a/responses/commit-something.md +++ b/responses/commit-something.md @@ -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 "" + ``` +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 %}

Return to this issue for my response

diff --git a/responses/create-a-branch.md b/responses/create-a-branch.md index 17321a8..6116f75 100644 --- a/responses/create-a-branch.md +++ b/responses/create-a-branch.md @@ -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 + ``` +1. Push the branch to GitHub: + ``` + git push --set-upstream origin + ``` +{% 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: ** or press the “Enter” key to create your branch +{% endif %}

Return to this issue for my response

diff --git a/responses/pr-succeeds.md b/responses/pr-succeeds.md index b5d6eae..302bd8a 100644 --- a/responses/pr-succeeds.md +++ b/responses/pr-succeeds.md @@ -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**.
diff --git a/responses/request-changes.md b/responses/request-changes.md index 4cd148c..5122cc2 100644 --- a/responses/request-changes.md +++ b/responses/request-changes.md @@ -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 "" + ``` +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 %}

Watch below for my response