Created
May 20, 2020 21:37
-
-
Save hamelsmu/f8f98e0fa18852c576973051d3cf72b1 to your computer and use it in GitHub Desktop.
Label your pull requests with mybinder.org links. This allows collaborators to view your files in a Jupyter Notebook environment with correct dependencies without cloning or building your repo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: `[](https://mybinder.org/v2/gh/${context.repo.owner}/${context.repo.repo}/${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` | |
}) | |
env: | |
BRANCH_NAME: ${{ github.event.pull_request.head.ref }} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place this file in
.github/workflows
in your GitHub repository. Next time a PR is opened, Actions will drop a link to mybinder.org with a link to the correct branch and repo. Your collaborators can now click on this link and be dropped into a Jupyter notebook environment with the right dependencies without having to build your project.