@@ -142,7 +142,7 @@ def _extract_data(cls, raw_data: dict) -> list:
142142 if "milestone" in item_data :
143143 item .milestone = item_data ["milestone" ]["title" ]
144144
145- if "assignee " in item_data :
145+ if "assignees " in item_data :
146146 item .assignee = item_data ["assignees" ]
147147
148148 item_list .append (item )
@@ -309,7 +309,8 @@ class ProjectItem:
309309 number: number of the item in the repository
310310 title: title of the item
311311 repo: repository where the item is located
312- status: status of the item
312+ status: status of the item in the project
313+ state: item state (draft, open, merged, closed)
313314 milestone: title of the milestone
314315 """
315316
@@ -325,6 +326,7 @@ def __init__(
325326 self .repo = repo
326327
327328 self .status = None
329+ self .state = None
328330 self .milestone = "None"
329331 self .assignee = None
330332
@@ -388,6 +390,16 @@ def add_comment(self, text: str, dry_run: bool = False) -> None:
388390 print (message )
389391 run_command (command )
390392
393+ def check_state (self ) -> str :
394+ """
395+ Fetch item state from gh and store to object
396+ """
397+ command = f"gh { self .command_type } view { self .number } --repo='{ PROJECT_OWNER } /{ self .repo } ' --json state"
398+ output = run_command (command )
399+ self .state = json .loads (output .stdout )["state" ]
400+
401+ return self .state
402+
391403
392404class PullRequest (ProjectItem ):
393405 """
0 commit comments