Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit aa02cf4

Browse files
author
bors-servo
authored
Auto merge of #114 - edunham:maxpriority, r=jdm
implement maximum priority If this deploys before servo/saltfs#660 lands, it might break. Tagging blocked on external till saltfs 660 lands. This is required to do #111 the easy way. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/homu/114) <!-- Reviewable:end -->
2 parents 7ac3136 + 607c5f5 commit aa02cf4

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

cfg.sample.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ access_token = ""
1010
app_client_id = ""
1111
app_client_secret = ""
1212

13+
# Priority values above max_priority will be refused.
14+
max_priority = 9001
15+
1316
[git]
1417

1518
# Use the local Git command. Required to use some advanced features. It also

homu/main.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,18 @@ def parse_commands(body, username, repo_cfg, state, my_username, db, states,
520520
realtime, my_username):
521521
continue
522522
try:
523-
state.priority = int(word[len('p='):])
523+
pvalue = int(word[len('p='):])
524524
except ValueError:
525-
pass
525+
continue
526526

527+
if pvalue > global_cfg['max_priority']:
528+
if realtime:
529+
state.add_comment(
530+
':stop_sign: Priority higher than @{} is ignored.'
531+
.format(global_cfg['max_priority'])
532+
)
533+
continue
534+
state.priority = pvalue
527535
state.save()
528536

529537
elif word.startswith('delegate='):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='homu',
5-
version='0.2.0',
5+
version='0.3.0',
66
author='Barosl Lee',
77
url='https://github.com/barosl/homu',
88
description=('A bot that integrates with GitHub '

0 commit comments

Comments
 (0)