Open a GitHub PR by sending a patch file by email.
$ pip3 install --trusted-host pypi.python.org -r requirements.txtWe'll need a couple things.
-
Email account access to send your patches.
Add information for
git send-emailto your.gitconfigfile. For Gmail, you can easily generate an app password. Under Select app, click Other (custom name) and simply enter something like email2pr.[sendemail] smtpEncryption = tls smtpServer = smtp.gmail.com smtpUser = smtpPass = smtpServerPort = 587 -
Email account access to receive patches.
This is the email address we'll send our
gitpatches to. You can use the same email address and application password generated above, or you can use another email address.You also need to know the host and port to connect to the IMAP4 server over SSL. Default values are provided for Gmail, so no need to worry about this if you're using Gmail.
-
GitHub account access to create pull requests.
Generate a personal access token. Under Note, you can again enter something like email2pr. Under Select scopes, you'll need to check at least public_repo, but you might want to simply check repo if you want this to work with your private repos).
Once you've gathered the necessary information, it's time to create your params.yaml file.
# Email account username (email address)
email_user:
# Email account password (generated app password)
email_pass:
# GitHub username for pushing changes and creating pull requests
repo_user:
# GitHub token (generated personal access token)
repo_token:
# Directory to use for cloning repos (optional, default: /tmp/email2pr)
repo_dir: /tmp/email2prYou can also define email_host and email_port if you don't want to use the default Gmail values.
First, launch email2pr in the root directory of this repository.
$ ./email2pr.pyEvery time you want to create a pull request:
-
Do your changes and commit.
Include the corresponding GitHub repo URL on the third line of your commit message. The
.gitsuffix is optional.$ git add your/file $ git commit -m "Do some changes<enter> $ <enter> $ Repo-Url: https://github.com/username-or-org/repo"
-
Create your patch file and send it.
For example, create a patch file from your last commit and then send it.
$ git format-patch -1 $ git send-email --to=emailaddress@gmail.com *.patch
- Does not support creating a PR from multiple patches/emails.
- No feedback after sending the patch by email (unless you have access to the
email2proutput directly).