Ready for Review won't be added to WIP/DNM (#30634)

This commit is contained in:
Jordan Brown
2017-09-16 13:24:58 -04:00
committed by KorPhaeron
parent 6401bb8264
commit 94fac71434

View File

@@ -243,15 +243,23 @@ function dismiss_review($payload, $id){
function check_ready_for_review($payload, $labels = null){ function check_ready_for_review($payload, $labels = null){
$r4rlabel = 'Ready for Review'; $r4rlabel = 'Ready for Review';
$labels_which_should_not_be_ready = array('Do Not Merge', 'Work In Progress', 'Merge Conflict');
$has_label_already = false; $has_label_already = false;
$should_not_have_label = false;
if($labels == null) if($labels == null)
$labels = get_labels($payload); $labels = get_labels($payload);
//if the label is already there we may need to remove it //if the label is already there we may need to remove it
foreach($labels as $L) foreach($labels as $L){
if($L == $r4rlabel){ if(in_array($L, $labels_which_should_not_be_ready))
$should_not_have_label = true;
if($L == $r4rlabel)
$has_label_already = true; $has_label_already = true;
break; }
}
if($has_label_already && $should_not_have_label){
remove_ready_for_review($payload, $labels, $r4rlabel);
return;
}
//find all reviews to see if changes were requested at some point //find all reviews to see if changes were requested at some point
$reviews = json_decode(apisend($payload['pull_request']['url'] . '/reviews'), true); $reviews = json_decode(apisend($payload['pull_request']['url'] . '/reviews'), true);