@@ -51,9 +51,16 @@ def gh(*args):
5151def fetch_items ():
5252 owner , name = REPO .split ("/" , 1 )
5353 out = gh (
54- "api" , "graphql" ,
55- "-f" , f"query={ QUERY } " ,
56- "-F" , f"owner={ owner } " , "-F" , f"name={ name } " , "-f" , f"label={ LABEL } " ,
54+ "api" ,
55+ "graphql" ,
56+ "-f" ,
57+ f"query={ QUERY } " ,
58+ "-F" ,
59+ f"owner={ owner } " ,
60+ "-F" ,
61+ f"name={ name } " ,
62+ "-f" ,
63+ f"label={ LABEL } " ,
5764 )
5865 nodes = json .loads (out )["data" ]["repository" ]["issues" ]["nodes" ]
5966 items = []
@@ -91,26 +98,28 @@ def splice(body, block):
9198 lines = body .split ("\n " )
9299 for i , line in enumerate (lines ):
93100 if line .strip () == HEADING :
94- lines [i + 1 : i + 1 ] = ["" , section ]
101+ lines [i + 1 : i + 1 ] = ["" , section ]
95102 return "\n " .join (lines )
96103 raise SystemExit (f"Heading not found in issue #{ MASTER } : { HEADING } " )
97104
98105
99106def main ():
100- body = gh ("issue" , "view" , str (MASTER ), "--repo" , REPO ,
101- "--json" , "body" , "-q" , ".body" )
107+ body = gh (
108+ "issue" , "view" , str (MASTER ), "--repo" , REPO , "--json" , "body" , "-q" , ".body"
109+ )
102110 old = body .replace ("\r \n " , "\n " ).rstrip ("\n " )
103111 new = splice (body , render (fetch_items ())).rstrip ("\n " )
104112
105113 if new == old :
106114 print ("Master issue already up to date." )
107115 return
108- with tempfile .NamedTemporaryFile ("w" , suffix = ".md" , delete = False ,
109- encoding = "utf-8" ) as f :
116+ with tempfile .NamedTemporaryFile (
117+ "w" , suffix = ".md" , delete = False , encoding = "utf-8"
118+ ) as f :
110119 f .write (new + "\n " )
111120 gh ("issue" , "edit" , str (MASTER ), "--repo" , REPO , "--body-file" , f .name )
112121 print (f"Updated issue #{ MASTER } ." )
113122
114123
115124if __name__ == "__main__" :
116- sys .exit (main ())
125+ sys .exit (main ())
0 commit comments