Skip to content

Commit

Permalink
Merge pull request #72 from jtpio/binder-prs
Browse files Browse the repository at this point in the history
Add a Binder on PR workflow
  • Loading branch information
jtpio authored Sep 6, 2021
2 parents 6ade9a0 + cb67d0d commit 496d4fc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
1 change: 0 additions & 1 deletion environment.yml → .binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ channels:
- conda-forge
dependencies:
- bqplot=0.12
- ipylab=0.4.1
- ipytree=0.2
- jupyterlab=3
- nodejs
Expand Down
7 changes: 7 additions & 0 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -e

jlpm && jlpm run build
python -m pip install -e .
jupyter labextension develop . --overwrite
30 changes: 30 additions & 0 deletions .github/workflows/binder-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Reference https://mybinder.readthedocs.io/en/latest/howto/gh-actions-badges.html
name: Binder Badge
on:
pull_request_target:
types: [opened]

permissions:
pull-requests:
write

jobs:
binder:
runs-on: ubuntu-latest
steps:
- name: comment on PR with Binder link
uses: actions/github-script@v1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
var PR_HEAD_REF = process.env.PR_HEAD_REF;
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/${PR_HEAD_USERREPO}/${PR_HEAD_REF}?urlpath=lab) :point_left: Try it on Binder (branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_)`
})
env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}

0 comments on commit 496d4fc

Please sign in to comment.