manics / action-binderbadge

GitHub action to comment on pull requests with a link to launch the PR on https://mybinder.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Append to PR description instead

skirpichev opened this issue · comments

Or have an option for this. Ex. to avoid Github notifications.

Sounds like a good idea! Do you have any thoughts on how action should check for an existing comment to update? Should it just look for a string that matches

const binderComment = `[![Binder](${binderUrl}/badge_logo.svg)](${binderUrl}/v2/gh/${pr.data.head.repo.full_name}/${pr.data.head.sha}${suffix}) ${commentText} ${pr.data.head.sha}`

Or do you think it should also check for a prefix/suffix/blank-lines/line etc to reduce the chance of it modifying a user's description?

That sounds as a safe default. But, I think, it should be configurable (not a required input) - an easy part.

@manics, thanks. This mostly works.

Yet, the pr description still updated after new commits even with persistentLink=false. My action:

$ cat .github/workflows/binder-badge.yml 
name: binder-badge
on:
  pull_request_target:
jobs:
  badge:
    runs-on: ubuntu-latest
    steps:
      - uses: manics/action-binderbadge@d7fc6853e6b1944335d7a280059e5556e7b6bf0e
        with:
          githubToken: ${{ secrets.GITHUB_TOKEN }}
          environmentRepo: gh/diofant/mybinder-env/HEAD
          urlpath: lab/tree/test.ipynb
          updateDescription: true
          persistentLink: false

It was working for me .... let me take another look

Here is a pr with the problem.

Currently this action only checks for exact duplicate comments, and appends a new "comment" if different, I thought that was safer (and easier!) than trying to modify an existing comment.

It looks like your two URLs are different:
https://mybinder.org/v2/gh/diofant/mybinder-env/HEAD?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252Fskirpichev%252Fsandbox%26branch%3Dpr2%26urlpath%3Dtest.ipynb
https://mybinder.org/v2/gh/diofant/mybinder-env/HEAD?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252Fskirpichev%252Fsandbox%26branch%3Dpr2%26urlpath%3Dlab%252Ftree%252Ftest.ipynb

Did you change urlpath: test.ipynb to urlpath: lab/tree/test.ipynb?

Yeah, I're right. Sorry for the noise. Thank you.