Skip to content

test

test #72

Workflow file for this run

name: Binder Badge
on:
pull_request_target:
types: [opened, synchronize]
jobs:
binder:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: comment on PR with Binder link
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
console.log("Context:", JSON.stringify(context, null, 2)); // For debugging
var PR_HEAD_REF = context.payload.pull_request.head.ref;
var PR_HEAD_USERREPO = context.payload.pull_request.head.repo.full_name;
var issue_number = context.payload.pull_request.number;
var owner = context.payload.pull_request.base.repo.owner.login;
var repo = context.payload.pull_request.base.repo.name;
github.rest.issues.createComment({
issue_number: issue_number,
owner: owner,
repo: repo,
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://binder.ploomber.io/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}) :point_left: Launch a binder notebook on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`
});