Skip to content

Commit 0938b89

Browse files
committed
Add project item priority support to schedule.py (#7474)
1 parent 30e7c80 commit 0938b89

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/schedule.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,21 @@ class FrontMatter(TypedDict, total=False):
3838
type: str
3939
labels: list[str]
4040
assignees: list[str]
41+
project_item_priority: str
4142
_repository: str
4243
_start: str
4344
_period: str
4445

4546

4647
azul_project_number = '3'
48+
azul_project_id = 'PVT_kwDOAfSQ384BCJY8'
49+
priority_field_id = 'PVTSSF_lADOAfSQ384BCJY8zg0ccQQ'
50+
priority_ids = {
51+
'++': 'bdf99630',
52+
'+': '3333032d',
53+
'-': '5e2e7b47',
54+
'--': 'b903d2dc',
55+
}
4756

4857

4958
@dataclass(kw_only=True)
@@ -212,6 +221,18 @@ def create_issue(self, title_date: date) -> None:
212221
process = subprocess.run(command, check=True, stdout=subprocess.PIPE)
213222
project = json.loads(process.stdout)
214223
assert project['id'], project
224+
priority = self.properties.get('project_item_priority')
225+
command = [
226+
'gh', 'project', 'item-edit',
227+
'--id', project['id'],
228+
'--field-id', priority_field_id,
229+
'--project-id', azul_project_id,
230+
'--single-select-option-id', priority_ids[priority]
231+
]
232+
process = subprocess.run(command, check=True, stdout=subprocess.PIPE)
233+
command_output = str(process.stdout)
234+
assert command_output.startswith('Edited item'), command_output
235+
assert issue['title'] in command_output, command_output
215236

216237
def verify_issue(self, assignees, issue, labels, repository, type, url):
217238
log.info('… created %r, verifying labels and assignees …', url)

0 commit comments

Comments
 (0)