I'm glad to announce my package Oh My GitHub[1] v1.0 is out. Besides bug fixes, it introduce a very practical feature: create pull request without leaving Emacs.
AFAIK, there already exists a similar package called github-pullrequest[2] does this job, but its interface is not very flexible, the PR's title and description is hard coded[3], of course this will break template[4] setup by owners if there exists one.
In oh-my-github
, M-x omg-pull-create
will open a org-mode buffer to edit what a PR required[5]:
title
repo
& branch
that your changes want to be merged intohead
, the name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch.draft
, Indicates whether the pull request is a draft.Those are PR's metadata, and users can define following metadata in org-mode buffer to set them:
#+TITLE:
#+TARGET-REPO: ${owner}/${repo}
#+TARGET-BRANCH:
#+SOURCE-HEAD:
#+DRAFT:
And oh-my-github
will use context git info to auto fill those field, for example
Users can define following directory variables(.dir-locals.el
) to automatically set those when default value doesn't make sense:
((nil . ((omg-pull-target-repo . "jiacai2050/oh-my-github")
(omg-pull-target-branch . "master")
(omg-pull-username . "jiacai2050")
(omg-pull-draft . "false"))))
As for description, oh-my-github
will detect whether ${project-root}/.github/pull_request_template.md
exists, and will insert following block when it's there:
#+begin_export markdown
// template's content
#+end_export
After fill in those information, users can C-c C-c
to submit it, or C-c C-k
to cancel this. If PR is created successfully, oh-my-github
will open the PR link via browse-url-default-browser
.
I have used this workflows for a while, and feels very comfortable.
Hope you guys will also enjoy this feature just like I enjoy making it!
[1]
Oh My GitHub: https://github.com/jiacai2050/oh-my-github
[2]
github-pullrequest: https://github.com/jakoblind/github-pullrequest
[3]
hard coded: https://github.com/jakoblind/github-pullrequest/blob/6ae5c38b0fc15b638b5ba4490112d9822ce5e267/github-pullrequest.el#L79
[4]
template: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository
[5]
what a PR required: https://docs.github.com/en/rest/pulls/pulls#create-a-pull-request