Skip to content

Commit 3999cc0

Browse files
authored
Auto binder on PR
1 parent ee5a8e8 commit 3999cc0

File tree

2 files changed

+24
-35
lines changed

2 files changed

+24
-35
lines changed

.github/workflows/binder-on-pr.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Reference https://mybinder.readthedocs.io/en/latest/howto/gh-actions-badges.html
2+
name: Binder Badge
3+
on: [pull_request_target]
4+
5+
jobs:
6+
binder:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: comment on PR with Binder link
10+
uses: actions/github-script@v1
11+
with:
12+
github-token: ${{secrets.GITHUB_TOKEN}}
13+
script: |
14+
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
15+
var PR_HEAD_REF = process.env.PR_HEAD_REF;
16+
github.issues.createComment({
17+
issue_number: context.issue.number,
18+
owner: context.repo.owner,
19+
repo: context.repo.repo,
20+
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}) :point_left: Launch a binder notebook on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`
21+
})
22+
env:
23+
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
24+
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}

.github/workflows/chatops-binder.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)