diff --git a/conf.yaml b/conf.yaml index 6d6fe30..8562642 100644 --- a/conf.yaml +++ b/conf.yaml @@ -186,15 +186,12 @@ repository: - plus__ge: 1 - has_tag__not: 'popularity/low' actions: - - - action: assign_tag - action_value: 'popularity/low' - action: remove_tag - action_value: 'popularity/medium + action_value: 'popularity/.*' - - action: remove_tag - action_value: 'popularity/significant' + action: assign_tag + action_value: 'popularity/low' - name: hotness - medium conditions: @@ -202,15 +199,12 @@ repository: - plus__ge: 4 - has_tag__not: 'popularity/medium' actions: - - - action: assign_tag - action_value: 'popularity/medium' - action: remove_tag - action_value: 'popularity/low + action_value: 'popularity/.*' - - action: remove_tag - action_value: 'popularity/significant' + action: assign_tag + action_value: 'popularity/medium' - name: hotness - spicy conditions: @@ -218,12 +212,9 @@ repository: - plus__ge: 10 - has_tag__not: 'popularity/significant' actions: - - - action: assign_tag - action_value: 'popularity/significant' - action: remove_tag - action_value: 'popularity/low + action_value: 'popularity/.*' - - action: remove_tag - action_value: 'popularity/medium + action: assign_tag + action_value: 'popularity/significant' diff --git a/process.py b/process.py index b8ed07e..77b2e00 100644 --- a/process.py +++ b/process.py @@ -256,10 +256,12 @@ def execute_assign_tag(self, pr, action): self.issue.add_to_labels(tag_name) def execute_remove_tag(self, pr, action): - """remove a tag from PR + """remove a tag from PR if it matches the regex """ - tag_name = action['action_value'] - self.issue.remove_from_labels(tag_name) + m = re.compile(action['action_value']) + for label in self.issue.get_labels(): + if m.match(label.name): + self.issue.remove_from_labels(label.name) class MergerBot(object):