Part 2: GitHub workflow
Workflow to contribute via GitHub
Bold words are git/GitHub terms. In this example there are two roles: an Author and a Reviewer.
- Author stages their changes
- Author commits changes with a helpful Commit message
- Author pushes to GitHub
- Author make a Pull Request and tag a reviewer from GitHub.com
- Reviewer responds by commenting, making suggested commits, and submitting their review
- Author responds to review and merges their Pull Request
- A GitHub Action automatically publishes the updates in the live site
Now that we have each saved some changes to files in our Quarto site source, we can contribute our updates using GitHub.
We will demonstrate this and then you will do this in breakout rooms.
Aside: set up our Git credentials
When you see the following screenshot, GitHub is asking for you to input your Git credentials. You see this when you have committed work to push to GitHub.com. In this case we have created a new branch and made changes to a file in the Hub and these do not yet exist on GitHub.
We’ll follow the instructions in the 2021 Cloud Hackathon to Setup your Personal Access Token (PAT).
Reviewer reviews the Pull Request
GitHub has gotten really powerful at doing reviews from the browser, so we can review small Pull Requests right here in GitHub.com. Note: When you are reviewing a Pull Request with a lot of code and analyses you need to run and dig into more deeply, you will do your review in JupyterHub by pulling the branch’s updates and committing your suggestions there. Today we will only practice a small review from the GitHub browser.
In GitHub under the “Files changed” tab of the PR, we can add a suggested edit by clicking the “plus” button below the line in question. Suggesting specific commits can speed the contributor’s workflow compared with trying to describe what we’d like them to change.
We can click “Start a review” button so the author gets a single email when we’re done reviewing, rather than getting one notification for every edit we suggest.
Review each individual file that has changed and come back to the main _quarto.yml
if we see an issue with the navigation.
Once our review is complete, we add a note in the GitHub review box and click “Approve”, “Comment” or “Request changes”. In the note it can be really helpful to add a note of appreciation for some aspect of the contribution, tagging the author, saying they can merge the PR after making changes, and possibly add a summary of our requested edits including the number of changes requested. Some changes in the middle of a long list of edits can be marked as hidden conversations, so this can be helpful to the author to know they’ve seen everything.
Your turn - Breakout rooms
Pair up in breakouts to make and review each other’s Pull Requests
We’ve done this demonstration - now you’ll go into breakout rooms. One of you be the Author role, and one the Reviewer role, with each of you screensharing where you are playing your role. Help each other out! If there is time, please switch roles
Steps:
- Author stages, commits, and pushes file
- Author makes a Pull Request
- Reviewer reviews the Pull Request
- Author merges Pull Request
- Make notes of any questions you have, challenges
Regroup & Wrap up
Review our updated site
Tidying up
Good practices to tidy your workspace & save unneccessary storage costs:
From GitHub Browser:
- Delete branch on GitHub Browser
From JupyterHub:
- Delete
stefanie
branch from the Git plugin - Delete quarto-clinic folder from terminal
cd ..
thenrm -rf quarto clinic
- Shut down Hub from File menu
Regroup discussion topics
Code & rendering .qmd
files
You can add code
When you Render, a document will be generated that includes both content and the output of embedded code. You can embed code like this:
TODO
You can add options to executable code. The echo: false
option disables the printing of code (only output is displayed).
Review in JupyterHub
Now, switch to the 2i2c Hub to view the Clinic preview as it would appear if the pull request was merged:
- Terminal:
- Go to the Main branch and pull so that we have the most recent changes from remote.
git checkout
to the branch that has the Pull Requestquarto preview
- this will build the book with the author’s suggested edits.
In reviewing a pull request with lots of changes, it can be helpful to have windows open to view both the GitHub browser and the 2i2c Hub showing the Clinic site preview.
Freeze
Commit the freeze folder.
- Freeze directory contains the results of code execution.
- Commit the freeze directory after you run quarto preview.
- If there are merge conflicts when you submit to NASA Earthdata Cloud Cookbook, maintainers will help resolve them.