Set priority based on label
This commit is contained in:
parent
b4e091a995
commit
dc3a933dc9
1 changed files with 16 additions and 1 deletions
|
@ -9,6 +9,20 @@ REPOS = {
|
||||||
'srobo/core-team-minutes': 2190856871
|
'srobo/core-team-minutes': 2190856871
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LABEL_TO_STATUS = {
|
||||||
|
'must have': 4,
|
||||||
|
'critical': 4,
|
||||||
|
'should have': 2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def get_status_for_issue(issue: Issue) -> int:
|
||||||
|
priorities = {
|
||||||
|
LABEL_TO_STATUS.get(label.name.lower(), 1)
|
||||||
|
for label in issue.labels
|
||||||
|
}
|
||||||
|
return max(priorities, default=1)
|
||||||
|
|
||||||
|
|
||||||
def get_issue_link(issue: Issue) -> str:
|
def get_issue_link(issue: Issue) -> str:
|
||||||
return "[#{id}]({url})".format(
|
return "[#{id}]({url})".format(
|
||||||
|
@ -45,7 +59,8 @@ def todoist_assigned_issues():
|
||||||
)['id']
|
)['id']
|
||||||
existing_task = todoist.items.get_by_id(existing_task_id)
|
existing_task = todoist.items.get_by_id(existing_task_id)
|
||||||
existing_task.update(
|
existing_task.update(
|
||||||
content=issue_to_task_name(issue)
|
content=issue_to_task_name(issue),
|
||||||
|
priority=get_status_for_issue(issue)
|
||||||
)
|
)
|
||||||
if issue.milestone and issue.milestone.due_on:
|
if issue.milestone and issue.milestone.due_on:
|
||||||
existing_task.update(date_string=issue.milestone.due_on.strftime("%d/%m/%Y"))
|
existing_task.update(date_string=issue.milestone.due_on.strftime("%d/%m/%Y"))
|
||||||
|
|
Reference in a new issue