diff --git a/.github/workflows/binder.yml b/.github/workflows/binder.yml new file mode 100644 index 00000000..8370fc9a --- /dev/null +++ b/.github/workflows/binder.yml @@ -0,0 +1,29 @@ +name: Binder +on: + pull_request: + types: [opened, reopened] + +jobs: + Create-Binder-Badge: + runs-on: ubuntu-latest + steps: + + - name: checkout pull request branch + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: comment on PR with Binder link + uses: actions/github-script@v1 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + var BRANCH_NAME = process.env.BRANCH_NAME; + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${context.repo.owner}/${context.repo.repo}/${BRANCH_NAME}?urlpath=lab) :point_left: Launch a binder notebook on this branch` + }) + env: + BRANCH_NAME: ${{ github.event.pull_request.head.ref }} diff --git a/README.md b/README.md index 594ac9f1..31088504 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ In all cases, learners should follow along the worked examples in each lesson by Lessons ------- > Launch an interactive session with this module using the Binder service: -[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/barbagroup/CFDPython/master) +[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/barbagroup/CFDPython/master?urlpath=lab) Steps 1–4 are in one spatial dimension. Steps 5–10 are in two dimensions (2D). Steps 11–12 solve the Navier-Stokes equation in 2D. Three "bonus" notebooks cover the CFL condition for numerical stability, array operations with NumPy, and defining functions in Python. @@ -111,6 +111,12 @@ Once Jupyter is installed, open up a terminal and then run jupyter notebook ``` +or if you want to run JupyterLab + +```Bash +jupyter lab +``` + This will start up a Jupyter session in your browser! ## How to contribute to CFD Python