Skip to content

Commit f62e686

Browse files
committed
Update import to include area owners
1 parent d8229d1 commit f62e686

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

scripts/import.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@
3030
'Website',
3131
)
3232

33+
AREA_OWNERS = (
34+
'committee',
35+
'health-safety',
36+
'media-press',
37+
'teams',
38+
'mentoring',
39+
'kit',
40+
'event-logistics',
41+
'livestream',
42+
'production',
43+
'game',
44+
'volunteer-coordination',
45+
'simulator',
46+
)
47+
3348

3449
def process(element_name: str, *, year: str, handle_dep: Callable[[str], int]) -> Ticket:
3550
"""
@@ -64,6 +79,10 @@ def process(element_name: str, *, year: str, handle_dep: Callable[[str], int]) -
6479
if component not in COMPONENTS:
6580
raise RuntimeError(f"{path} has an unknown component: {component}")
6681

82+
area_owner = raw_elements.get('area-owner')
83+
if area_owner not in AREA_OWNERS:
84+
raise RuntimeError(f"{path} has an unknown area owner: {area_owner}")
85+
6786
milestone = raw_elements.get('milestone')
6887
dependencies = raw_elements.get('dependencies', ())
6988

@@ -75,6 +94,7 @@ def process(element_name: str, *, year: str, handle_dep: Callable[[str], int]) -
7594
priority=priority,
7695
milestone=milestone,
7796
original_name=element_name,
97+
area_owner=area_owner,
7898
description=description,
7999
dependencies=computed_dependencies,
80100
)

scripts/import_backends.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,20 @@ class GitHubBackend:
151151
'blocker': 'I: Must Have',
152152
}
153153

154+
AREA_OWNER_MAPPING: Dict[str, str] = {
155+
'committee': 'AO: Committee',
156+
'health-safety': 'AO: Health & Safety',
157+
'media-press': 'AO: Media & Press',
158+
'teams': 'AO: Teams',
159+
'mentoring': 'AO: Mentoring',
160+
'kit': 'AO: Kit',
161+
'event-logistics': 'AO: Event Logistics',
162+
'game': 'AO: Game',
163+
'production': 'AO: Production',
164+
'simulator': 'AO: Simulator',
165+
'livestream': 'AO: Livestream',
166+
}
167+
154168
def __init__(self, repo_name: str) -> None:
155169
self.github = github.Github(get_github_credential())
156170
self.repo = self.github.get_repo(repo_name)
@@ -170,6 +184,9 @@ def __init__(self, repo_name: str) -> None:
170184
self._component_priority_mapping = {
171185
k: labels[v] for k, v in self.COMPONENT_PRIORITY_MAPPING.items()
172186
}
187+
self._area_owner_mapping = {
188+
k: labels[v] for k, v in self.AREA_OWNER_MAPPING.items()
189+
}
173190
except KeyError as e:
174191
raise ValueError(
175192
f"Label {e} does not exist within {repo_name!r}",
@@ -213,6 +230,7 @@ def get_or_create_milestone(self, title: str) -> github.Milestone.Milestone:
213230
def labels(self, ticket: Ticket) -> List[github.Label.Label]:
214231
labels = [self._component_priority_mapping[ticket.priority]]
215232
labels += self._component_label_mapping[ticket.component]
233+
labels.append(self._area_owner_mapping[ticket.area_owner])
216234
return labels
217235

218236
def submit(self, ticket: Ticket) -> int:

scripts/ticket_type.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ class Ticket(NamedTuple):
77
component: str
88
original_name: str
99
milestone: str
10+
area_owner: str
1011
description: str
1112
dependencies: List[int]

0 commit comments

Comments
 (0)