Would it be cool to have a "Create Pull Request" button on the mybinder Jupyter page?
NHDaly opened this issue · 5 comments
An idea/feature request:
I think it would be nice to have a button on the Jupyter page produced at http://mybinder.org/repo/user/project
that allows you to create a commit out of your changes, forks the repository for you on github, and sends a pull request. That way you can tinker with someone's binder, and if you really like your changes, you can automatically send the changes as an encapsulated process.
That said, the above workflow sounds like a lot of work to implement. The button would need to:
1a. Commit your changes inside the docker instance.
2a. Integrate with GitHub (meaning, sign you in and connect to the API, I guess?).
3a. Fork the original Repo on your behalf.
4a. Add your fork as a remote.
5a. Push the changes.
6a. Open a Pull Request for you.
7a. Provide you a link to your PR.
That seems like way too much.
But perhaps we could start with a simplified flow? Something like this?:
Pressing the button will:
1b. Commit your changes inside the docker instance.
2b. Expose the git repository over HTTP. Something like http://app.mybinder.org:80/<id>/repo.git
?
2b. Present the user with a dialogue and instructions saying something like:
Okay, your change is ready! |
---|
Follow these instructions to send your changes to USER/REPO : 1. Navigate to github.com/USER/REPO and click to Fork the repo 2. In a terminal enter the following commands: $ git clone https://github.com/YOUR-USERNAME/REPO $ git pull http://app.mybinder.org:80/<binder-id>/repo.git binder-forked-changes $ git push https://github.com/YOUR-USERNAME/REPO binder-forked-changes 3. Now navigate to https://github.com/YOUR-USERNAME/REPO/tree/binder-forked-changes and open a Pull Request for your branch (or [click here](https://github.com/USER/REPO/compare/master...YOUR-USERNAME:binder-forked-changes) to jump straight to the pull request) |
I think this is actually a pretty good first step. What do you think?
I guess to get this to work, we'd just have to change the base docker setup to install a Jupyter plugin that we write? That's actually pretty doable. Does that sound right?
@NHDaly thanks for working through this issue! Really liking the ideas you're proposing -- we had talked about something like this before, but adding GitHub integration into a plugin did seem like a considerable amount of work, and so this issue got pushed back.
Being able to push changes back to GitHub as a PR, and doing that with a single button click via authentication would be great, but we should think about if exposing that git repo simplifies the process enough to justify the added complexity. Since that approach still requires you to open up a terminal, run a series of commands, and visit GitHub, it's worth comparing it to the naive way:
- Fork/clone the repository onto your local machine
- Save out the edited notebook through
File -> Save As
- Copy the saved notebook into your repo, then commit/push to your fork
- Open the PR on GitHub
Both approaches require similar steps, and my thinking is that the version that doesn't introduce an extra git repo might be sufficient until the full-fledged GitHub integration is set up.
Thoughts on that? Definitely would be straightforward to set your version up if we can determine that it makes the whole process easier. And yeah, it would probably just require adding a small plugin to the base image, though edits to the base image need to be considered carefully.
Hey again! Sorry for the delay -- I moved from California to Chicago! Thanks for your quick response!
Hmm, I agree that a single button would be way better, but also that it would be way more work.
My thoughts regarding the naïve way:
- If there are multiple files you've changed in the repo, you'd have to save all of them.
- For many people, including people I have personally shared my repo with who are data people (econ && bio), not software engineers, they would not know the steps to fork a repository, overwrite its files, and push it as a PR. Even many of my software engineer friends who don't use Github (Googlers) don't really know what a PR is. :P
- So I'm thinking whatever we do, it would be nice to have instructions from within the Notebook.
- In fact, the reason I had this idea was that one of my friends called me to tell me about things he changed in my notebook that i might want to consider changing.
- Finally, I think copy/pasting text commands is a lot faster/easier than downloading files and then moving them to a new location (only after you've cloned the repo). I like that it's mostly self-contained.
But yeah, I can see that the marginal benefit might not be that large?
Final thought: if you were to eventually include github integration, it would require doing some of these steps (commit the local changes to the Repo and make a new branch)? So maybe this is progress in a nice direction?
What do you think?
But yeah, my main focus is on people who are less familiar with git and just use it when necessary. Those people are happy copy/pasting git commands, but might not have the practice with the tools to think to do all those steps on their own.
But even for me, it's just faster to copy-paste a bunch of commands and follow instructions, even when i know what i'm doing. :)