jupyterhub / mybinder.org-user-guide

Turn a Git repo into a collection of interactive notebooks. This is Binder's user documentation repository.
https://mybinder.readthedocs.io
BSD 3-Clause "New" or "Revised" License
151 stars 103 forks source link

Add binder badge only on PR opened event #218

Closed fcollonval closed 3 years ago

fcollonval commented 3 years ago

Follow-up of #217

As suggested by @consideRatio, this reduce this action to the open event on a PR. I also add the PR origin repo name in the comment to clarify it when the PR comes from a fork.

choldgraf commented 3 years ago

SO just to clarify - the current behavior is that it adds the badge each time that a commit is made? And this one makes it only happen on the "opening" action

consideRatio commented 3 years ago

SO just to clarify - the current behavior is that it adds the badge each time that a commit is made? And this one makes it only happen on the "opening" action

This comment clarifies it: https://github.com/jupyterhub/binder/pull/217#issuecomment-724559137. GitHub docs writes...

By default, a workflow only runs when a pull_request_target's activity type is "opened, synchronize, or reopened". To trigger workflows for more activity types, use the types keyword. For more information, see "Workflow syntax for GitHub Actions."

But what is "synchronize"? This was described in https://github.community/t/what-is-a-pull-request-synchronize-event/14784/4?u=consideratio.

What this implies is that if you push a new commit to the HEAD ref of a pull request then this “synchronize” event will be triggered. This is because the system is syncing the pull requests with the latest changes. This will NOT trigger if the base ref is updated.

To conclude - yes I think you are right @choldgraf, it would trigger on commits being added as well before this PR.

fcollonval commented 3 years ago

To conclude - yes I think you are right @choldgraf, it would trigger on commits being added as well before this PR.

To demonstrate that, I hit the synchronized event in https://github.com/mamba-org/gator/pull/95#issuecomment-725347945

The first one was nice as it added the badge following a rebase on the master introducing the github action. But the second time when a commit was added sounds definitely too noisy.

So I think triggering a binder badge on a PR branch when the PR is opened is the best workflow. JupyterLab has that feature using a GitHub app (predate the GitHub actions) and it is quite a nice feature.

choldgraf commented 3 years ago

sounds great - I think we're all +1 on this yeah? Gonna merge it in!