Discourse 代码审查

:discourse2: Summary Discourse Code Review allows the ability to review GitHub commits on Discourse.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-code-review
:open_book: Install Guide How to install plugins in Discourse

Features

What it is?

The Discourse Code Review plugin provides 2 way integration with GitHub code repositories. It allows your team to review commits to a repository leveraging Discourse features and plugins such as assign, whispers, notification, custom workflows and so on. Each commit to a repository becomes a topic. Replies to the topic are mirrored on GitHub. Integration is bi-directional meaning you can comment on Discourse and see it in GitHub or comment in GitHub and see it in Discourse.

It provides a very powerful workflow for teams who need to to review all commits to any number of repositories.

It allows you to ensure that multiple team members are aware of all changes applied to repositories. You can mark commits for follow-up, assign out review work and more.

Note: When viewing a topic that can be approved, you can use the y button on your keyboard to approve commits faster.

Can I see it in Action?

Discourse maintains https://review.discourse.org/ this site is public and anyone can sign up using GitHub credentials. The site only surfaces a subset of features to non staff members. A more complete example may be:

On GitHub the same topic looks like this:

Configuration

The plugin relies on GitHub webhooks to discover repositories and changes on repositories. For a minimal configuration you will need to set the following setting to a secret string.

code review github webhook secret

Once set on your GitHub repository setup a webhook with:

Payload URL: https://YOUR_DISCOURSE/code-review/webhook
Content Type: application/json
Secret: the value of code review github webhook secret
Event Types:

  • Commit comments
  • Issue comments
  • Pull requests
  • Pull request reviews
  • Pull request review comments
  • Pushes

The plugin provides the following additional site settings:

code review api username : GitHub is very restrictive with the number of anonymous API requests it allows, this setting allows you to use a Discourse user’s account keys for /comments and /commit requests. This heavily reduces chances of hitting rate limits.

code review catch up commits : number of commits to “catch up” and create topics for when you encounter a new repo.

code review default parent category: choose a default parent category for categories created by the plugin

code review pending tag: Tag to apply to all unreviewed commits, pending by default

code review approved tag: Tag to apply to approved commits, approved by default

code_review_followup_tag: Tag to apply to follow-up commits follow-up by default

code review allow self approval: Are staff allowed to approve own commits?

code review default mute new categories: New categories created by code review are muted for users by default

code review skip duration minutes: Clicking the skip button on a commit will prevent that commit from showing up again for the number of minutes set by this setting.

CHANGELOG

TODO

Extras

How Discourse Uses This Plugin

TL;DR - This plugin was designed to complement the Discourse team’s use of GitHub for code review.

More Information

From @sam:

  • We still use PRs using GitHub UI and love doing PRs for lots of changes. Nothing has changed here. GitHub is fantastic, we love GitHub. They have an excellent workflow for changes that have not yet landed. However…

  • GitHubs workflow for changes that have been committed directly to the repository is terrible.

  • Review fills a gap that simply can not be filled with GitHub today, we would like at least one team member to review every change made to our various Discourse owned git repos. If we are to use the GitHub provided UI nobody will ever be allowed to do anything but pull requests. This would slow us down enormously.

  • We need the ability to communicate privately without the whole world knowing with regards to certain changes. For example: We better get this awesome fix deployed to <insert giant company name> ASAP, @sam can you take care of it ?

  • We need the ability to approve changes made or request follow-up, this is not something the GitHub UI offers.

  • We need the ability to assign particular commits to a user. Say @sam makes a commit containing some mistakes It is nice that we can directly assign him that particular commit, mark it for followup and then keep track of it being followed up.

  • Discourse is pretty fantastic at this whole conversation thing, and the little features make a pretty big difference, I can see when people are typing. I never need to refresh pages for changes to pop up. Quoting is really nice, image uploads are nice, and so on.

  • Discourse is really good at read state, you get very strong guarantees that you read every single thing once, with GitHub I have no idea what commits I read and which I did not. We have an incredibly efficient to cope with firehose of information.

And the list goes on…

So review acts as a complement to GitHub, we use GitHub at the moment to cope with changes that have not yet landed. And we use review to properly handle changes that have already landed.

70 个赞

我试图了解这个插件的用途。我有一种预感,我需要类似的东西,但我很难看出它如何提高效率。当有人批准一个拉取请求并将其合并到一个分支时,你们的流程中有什么使得该批准还需要对关联的提交进行另一次批准?

GitHub 不提供与提交相关的此功能,因为假设这已经在拉取请求中处理过了。我错过了什么?

是因为你们团队中有一些人可以批准拉取请求,但没有资格就实际发布做出最终决定吗?这样做的目的是为了能够快速合并和审查拉取请求,而不必等待最终拍板的人,并确保该人员或团队在创建发布之前会审查提交?

或者主要是为了支持公共仓库上的私人讨论?

我很想更多地了解在此插件在你们工作流程中的好处。谢谢!

这主要是 Discourse 早期工作流程的遗留物。

以前,我们用它来追溯性地批准变更集。

现在,所有内容都通过 PR 渠道进行,所以我们实际上并没有过多使用该插件。

1 个赞