Skip to content

Commit

Permalink
Add github workflow to automatically comment the binderlink on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
camriddell committed May 2, 2023
1 parent 0c58cd1 commit b15cf5d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/comment_binderlink.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
pull_request:
types: [opened, reopened]
branches:
- master
jobs:
comment-binderlink:
permissions: write-all
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: comment on PR with Binder link
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
var BRANCH_NAME = process.env.BRANCH_NAME;
await github.rest.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`
})
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}

0 comments on commit b15cf5d

Please sign in to comment.