前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Oh My GitHub 1.0 is out!

Oh My GitHub 1.0 is out!

作者头像
飞驰的西瓜
发布2022-12-14 18:32:17
2140
发布2022-12-14 18:32:17
举报
文章被收录于专栏:EmacsTalk

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
  • • the target repo & branch that your changes want to be merged into
  • head, 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:

代码语言:javascript
复制
#+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

  • • use last commit message as title
  • • use current branch as source head

Users can define following directory variables(.dir-locals.el) to automatically set those when default value doesn't make sense:

代码语言:javascript
复制
((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:

代码语言:javascript
复制
#+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

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-11-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 EmacsTalk 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 引用链接
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档