From 28531ab43666b5fdf37e0a70db3bcbf7d3f92183 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Mon, 8 Apr 2019 11:44:57 +0100 Subject: Pick reviewers based on branch name Change reviewer roulette to always pick the same reviewers for the same branch name. We do this by: 1. Making the branch name 'canonical' across CE and EE by stripping a leading 'ce-' or 'ee-' and a trailing '-ce' or '-ee'. If people are following our branch naming guidelines, this should give the same branch name in both repos. 2. Converting the branch name to a stable integer by taking the integer form of its MD5. 3. Passing that integer as a seed to Ruby's `Random` class, which 'may be used to ensure repeatable sequences of pseudo-random numbers between different runs of the program' (from the Ruby documentation). The upshot is that the same branch name (in CE and EE) should always pick the same reviewers, and those should be evenly distributed across the set of possible reviewers due to the use of MD5. --- danger/roulette/Dangerfile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'danger') diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile index 406dc2c9724..e6820f49ee2 100644 --- a/danger/roulette/Dangerfile +++ b/danger/roulette/Dangerfile @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'digest/md5' + MESSAGE = <