Skip to content

2. Reviewing pull requests

Lidefi87 edited this page Aug 5, 2024 · 5 revisions

You can see all the open pull requests under the "Pull requests" tab. These are essentially modifications or updates a contributor has made, that need to be reviewed to ensure, for example, that the recipe is well documented and understandable, that it runs, that it contains no bugs, etc. Check out our tips for reviewing here.

Add yourself as a reviewer on the 'Reviewers" tab on the left.

Synchronise your fork with upstream

Syncing frequently is a good way of avoiding conflicts when merging/pulling/pushing. You can do this by running the following in your gadi session:

git fetch upstream
git merge upstream/main

This grabs the latest changes in the upstream repository (COSIMA/cosima-recipes) and merges them into your main branch in your gadi clone. You can push these into your fork (origin) repository (your_user_name/cosima-recipes):

git push origin main

Create a branch with the pull request

On the upper right corner of the Pull Request page, you will find a "Code" button. When you click on it, you will see you can copy something like this:

gh pr checkout 417

but instead of 417 you will have another number corresponding to your pull request. Run that line above in your gadi session. This will allow you to run the code that you are reviewing in gadi. You might be prompted with the following error message: please run gh repo set-default to select a default remote repository. If so, simply run gh repo set-default and select COSIMA/cosima-recipes as the default.

Note that this will create and checkout a new branch with the pull request, called something like changes_to_something. Verify that the example runs without error messages, look out for bugs 🐞 and see that it is well documented. Maybe you know of a more efficient way of doing something. Anything you think will improve the example is great!

Add your reviewer comments

In the Pull Request page, you will see that there is a review-notebook-app bot that creates a ReviewNB link. You can click on it to comment on specific lines of code. Comment away! Once you are done with the reviews at the top of the page you will see an "Add your review": button. Click on it, comment something like "See comments on ReviewNB" and hit the "Request changes" option.

If you can't find the "Add your review" button at the top of the page it is because you have not added yourself as a reviewer.

Note: it is also an option to make changes to the Example yourself, commit and then push. However, if someone else is actively working on the example you are reviewing, your pushing will more likely create conflicts. So it is recommended to do the review by ReviewNB, unless there is no one actively working on the example.

Approve once you are satisfied

Use the "Add your review" button, but with the "Approve" option.

Clean up

Since this branch only existed in your gadi clone, you can just delete it once you are done: Delete the branch and push the deletion:

git branch -D changes_to_something

Thank you for reviewing!