generated from geo-smart/use_case_template
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (36 loc) · 1.35 KB
/
binder-badge.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: AddBinderBadge
# https://github.com/jupyterhub/repo2docker-action#cache-builds-on-mybinderorg-and-provide-a-link
on:
pull_request:
types: [opened, reopened]
paths:
- 'book/tutorials/**'
- '.github/workflows/binder-badge.yml'
- 'conda/**'
jobs:
add-badge:
runs-on: ubuntu-22.04
steps:
- name: Checkout PR
uses: actions/checkout@v3
- name: cache binder build on mybinder.org
uses: jupyterhub/repo2docker-action@master
with:
NO_PUSH: true
MYBINDERORG_TAG: ${{ github.event.pull_request.head.ref }}
- name: Comment on PR with Binder link
uses: actions/github-script@v3
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
CONTENT_REPO: ${{github.event.pull_request.head.repo.full_name}}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
var BRANCH_NAME = process.env.BRANCH_NAME;
var CONTENT_REPO = process.env.CONTENT_REPO;
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}) :point_left: Launch a binder notebook on this branch`
})