Skip to content

Commit

Permalink
expect remove_tag action value as regex
Browse files Browse the repository at this point in the history
also try removing label only if present
  • Loading branch information
martenson committed Feb 5, 2016
1 parent dca2996 commit 46a5218
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
27 changes: 9 additions & 18 deletions conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,44 +186,35 @@ 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:
- state: 'open'
- 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:
- state: 'open'
- 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'
8 changes: 5 additions & 3 deletions process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 46a5218

Please sign in to comment.