@@ -99,6 +99,11 @@ def action(
9999
100100 # check_run_id = check.create_check_run()
101101 check_run_id = check .find_run_for_action ()
102+ check .update_check_run (
103+ check_run_id ,
104+ status = "in_progress" ,
105+ output = {"title" : "Flake8 checks" , "summary" : "Output from Flake8" },
106+ )
102107
103108 flake8_app = Application ()
104109 flake8_app .run (args )
@@ -110,32 +115,34 @@ def action(
110115 for filename , raw_annotations in json_annotations :
111116 annotations .extend (Annotation .from_flake8json (filename , ann ) for ann in raw_annotations )
112117
113- # Github limits updates to 50 annotations at a time
114- annotation_chunks = list (chunks (annotations , 50 ))
115-
116- if flake8_app .result_count :
117- conclusion = "failure"
118- ret = 1
119- else :
120- conclusion = "success"
121- ret = 0
122-
123- for chunk in annotation_chunks [:- 1 ]:
124- check .update_check_run (
125- check_run_id ,
126- conclusion = conclusion ,
127- output = {
128- "title" : "Flake8 checks" ,
129- "summary" : "Output from Flake8" ,
130- "annotations" : [a .to_dict () for a in chunk ],
131- },
132- )
133-
134- output = {
135- "title" : "Flake8 checks" ,
136- "summary" : "Output from Flake8" ,
137- "annotations" : [a .to_dict () for a in annotation_chunks [- 1 ]],
138- }
139-
140- # TODO: reflect flake8 output
141- return check .complete_check_run (check_run_id , conclusion = "success" , output = output ), ret
118+ if annotations :
119+ # Github limits updates to 50 annotations at a time
120+ annotation_chunks = list (chunks (annotations , 50 ))
121+
122+ if flake8_app .result_count :
123+ conclusion = "failure"
124+ ret = 1
125+ else :
126+ conclusion = "success"
127+ ret = 0
128+
129+ for chunk in annotation_chunks [:- 1 ]:
130+ check .update_check_run (
131+ check_run_id ,
132+ conclusion = conclusion ,
133+ output = {
134+ "title" : "Flake8 checks" ,
135+ "summary" : "Output from Flake8" ,
136+ "annotations" : [a .to_dict () for a in chunk ],
137+ },
138+ )
139+
140+ output = {
141+ "title" : "Flake8 checks" ,
142+ "summary" : "Output from Flake8" ,
143+ "annotations" : [a .to_dict () for a in annotation_chunks [- 1 ]],
144+ }
145+
146+ return check .complete_check_run (check_run_id , conclusion = conclusion , output = output ), ret
147+
148+ return check .complete_check_run (check_run_id , conclusion = "success" ), 0
0 commit comments