mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
commit
9a7c99199a
@ -1,87 +0,0 @@
|
||||
translating---geekpi
|
||||
|
||||
Stop merging your pull requests manually
|
||||
======
|
||||
|
||||
![](https://julien.danjou.info/content/images/2018/06/github-branching.png)
|
||||
|
||||
If there's something that I hate, it's doing things manually when I know I could automate them. Am I alone in this situation? I doubt so.
|
||||
|
||||
Nevertheless, every day, they are thousands of developers using [GitHub][1] that are doing the same thing over and over again: they click on this button:
|
||||
|
||||
![Screen-Shot-2018-06-19-at-18.12.39][2]
|
||||
|
||||
This does not make any sense.
|
||||
|
||||
Don't get me wrong. It makes sense to merge pull requests. It just does not make sense that someone has to push this damn button every time.
|
||||
|
||||
It does not make any sense because every development team in the world has a known list of pre-requisite before they merge a pull request. Those requirements are almost always the same, and it's something along those lines:
|
||||
|
||||
* Is the test suite passing?
|
||||
* Is the documentation up to date?
|
||||
* Does this follow our code style guideline?
|
||||
* Have N developers reviewed this?
|
||||
|
||||
|
||||
|
||||
As this list gets longer, the merging process becomes more error-prone. "Oops, John just clicked on the merge button while there were not enough developer that reviewed the patch." Rings a bell?
|
||||
|
||||
In my team, we're like every team out there. We know what our criteria to merge some code into our repository are. That's why we set up a continuous integration system that runs our test suite each time somebody creates a pull request. We also require the code to be reviewed by 2 members of the team before it's approbated.
|
||||
|
||||
When those conditions are all set, I want the code to be merged.
|
||||
|
||||
Without clicking a single button.
|
||||
|
||||
That's exactly how [Mergify][3] started.
|
||||
|
||||
![github-branching-1][4]
|
||||
|
||||
[Mergify][3] is a service that pushes that merge button for you. You define rules in the `.mergify.yml` file of your repository, and when the rules are satisfied, Mergify merges the pull request.
|
||||
|
||||
No need to press any button.
|
||||
|
||||
Take a random pull request, like this one:
|
||||
|
||||
![Screen-Shot-2018-06-20-at-17.12.11][5]
|
||||
|
||||
This comes from a small project that does not have a lot of continuous integration services set up, just Travis. In this pull request, everything's green: one of the owners reviewed the code, and the tests are passing. Therefore, the code should be already merged: but it's there, hanging, chilling, waiting for someone to push that merge button. Someday.
|
||||
|
||||
With [Mergify][3] enabled, you'd just have to put this `.mergify.yml` a the root of the repository:
|
||||
```
|
||||
rules:
|
||||
default:
|
||||
protection:
|
||||
required_status_checks:
|
||||
contexts:
|
||||
- continuous-integration/travis-ci
|
||||
required_pull_request_reviews:
|
||||
required_approving_review_count: 1
|
||||
|
||||
```
|
||||
|
||||
With such a configuration, [Mergify][3] enables the desired restrictions, i.e., Travis passes, and at least one project member reviewed the code. As soon as those conditions are positive, the pull request is automatically merged.
|
||||
|
||||
We built [Mergify][3] as a **free service for open-source projects**. The [engine powering the service][6] is also open-source.
|
||||
|
||||
Now go [check it out][3] and stop letting those pull requests hang out one second more. Merge them!
|
||||
|
||||
If you have any question, feel free to ask us or write a comment below! And stay tuned — as Mergify offers a few other features that I can't wait to talk about!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://julien.danjou.info/stop-merging-your-pull-request-manually/
|
||||
|
||||
作者:[Julien Danjou][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://julien.danjou.info/author/jd/
|
||||
[1]:https://github.com
|
||||
[2]:https://julien.danjou.info/content/images/2018/06/Screen-Shot-2018-06-19-at-18.12.39.png
|
||||
[3]:https://mergify.io
|
||||
[4]:https://julien.danjou.info/content/images/2018/06/github-branching-1.png
|
||||
[5]:https://julien.danjou.info/content/images/2018/06/Screen-Shot-2018-06-20-at-17.12.11.png
|
||||
[6]:https://github.com/mergifyio/mergify-engine
|
@ -0,0 +1,85 @@
|
||||
停止手动合并你的 pull 请求
|
||||
======
|
||||
|
||||
![](https://julien.danjou.info/content/images/2018/06/github-branching.png)
|
||||
|
||||
如果有什么我讨厌的东西,那就是当我知道我可以自动化它们时,但我手动进行了操作。只有我有这种情况么?我很怀疑。
|
||||
|
||||
尽管如此,他们每天都有数千名使用 [GitHub][1] 的开发人员一遍又一遍地做同样的事情:他们点击这个按钮:
|
||||
|
||||
![Screen-Shot-2018-06-19-at-18.12.39][2]
|
||||
|
||||
这没有任何意义。
|
||||
|
||||
不要误解我的意思。合并 pull 请求是有意义的。只是每次点击这个该死的按钮是没有意义的。
|
||||
|
||||
这样做没有意义因为世界上的每个开发团队在合并 pull 请求之前都有一个已知的先决条件列表。这些要求几乎总是相同的,而且这些要求也是如此:
|
||||
|
||||
* 是否通过测试?
|
||||
* 文档是否更新了?
|
||||
* 这是否遵循我们的代码风格指南?
|
||||
* 是否有 N 位开发人员对此进行审查?
|
||||
|
||||
|
||||
|
||||
随着此列表变长,合并过程变得更容易出错。 “糟糕,John 点了合并按钮,但没有足够的开发人员审查补丁。” 要发出警报么?
|
||||
|
||||
在我的团队中,我们就像外面的每一支队伍。我们知道我们将一些代码合并到我们仓库的标准是什么。这就是为什么我们建立一个持续集成系统,每次有人创建一个 pull 请求时运行我们的测试。我们还要求代码在获得批准之前由团队的 2 名成员进行审查。
|
||||
|
||||
当这些条件全部设定好时,我希望代码被合并。
|
||||
|
||||
而不用点击一个按钮。
|
||||
|
||||
这正是启动 [Mergify][3] 的原因。
|
||||
|
||||
![github-branching-1][4]
|
||||
|
||||
[Mergify][3] 是一个为你按下合并按钮的服务。你可以在仓库的 .mergify.yml 中定义规则,当规则满足时,Mergify 将合并该请求。
|
||||
|
||||
无需按任何按钮。
|
||||
|
||||
随机抽取一个请求,就像这样:
|
||||
|
||||
![Screen-Shot-2018-06-20-at-17.12.11][5]
|
||||
|
||||
这来自一个小型项目,没有很多持续集成服务,只有 Travis。在这个 pull 请求中,一切都是绿色的:其中一个所有者审查了代码,并且测试通过。因此,该代码应该被合并:但是它还在那里挂起这,等待某人有一天按下合并按钮。
|
||||
|
||||
使用 [Mergify][3] 后,你只需将 `.mergify.yml` 放在仓库的根目录即可:
|
||||
```
|
||||
rules:
|
||||
default:
|
||||
protection:
|
||||
required_status_checks:
|
||||
contexts:
|
||||
- continuous-integration/travis-ci
|
||||
required_pull_request_reviews:
|
||||
required_approving_review_count: 1
|
||||
|
||||
```
|
||||
|
||||
通过这样的配置,[Mergify][3] 可以实现所需的限制,即 Travis 通过,并且至少有一个项目成员审阅了代码。只要这些条件是肯定的,pull 请求就会自动合并。
|
||||
|
||||
我们为将 [Mergify][3] **在开源项目中作为一个免费服务**。[提供服务的引擎][6]也是开源的。
|
||||
|
||||
现在去[尝试它][3],并停止让这些 pull 请求挂起一秒钟。合并它们!
|
||||
|
||||
如果你有任何问题,请随时在下面向我们提问或写下评论!并且敬请期待 - 因为 Mergify 还提供了其他一些我迫不及待想要介绍的功能!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://julien.danjou.info/stop-merging-your-pull-request-manually/
|
||||
|
||||
作者:[Julien Danjou][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://julien.danjou.info/author/jd/
|
||||
[1]:https://github.com
|
||||
[2]:https://julien.danjou.info/content/images/2018/06/Screen-Shot-2018-06-19-at-18.12.39.png
|
||||
[3]:https://mergify.io
|
||||
[4]:https://julien.danjou.info/content/images/2018/06/github-branching-1.png
|
||||
[5]:https://julien.danjou.info/content/images/2018/06/Screen-Shot-2018-06-20-at-17.12.11.png
|
||||
[6]:https://github.com/mergifyio/mergify-engine
|
Loading…
Reference in New Issue
Block a user