This commit is contained in:
alyssa 2024-09-06 16:54:10 +09:00
parent 2cedff5390
commit 35dfe8d86c

View file

@ -31,7 +31,6 @@ def report_status(sha, name, start_time, exit=None):
data = { data = {
'name': name, 'name': name,
'head_sha': sha, 'head_sha': sha,
'status': status,
'started_at': start_time, 'started_at': start_time,
'output': { 'output': {
'title': name, 'title': name,
@ -43,6 +42,10 @@ def report_status(sha, name, start_time, exit=None):
if exit is not None: if exit is not None:
data['completed_at'] = datetime.datetime.now(tz=datetime.timezone.utc).isoformat(timespec='seconds') data['completed_at'] = datetime.datetime.now(tz=datetime.timezone.utc).isoformat(timespec='seconds')
data['completion'] = status
data['status'] = 'completed'
else:
data['status'] = status
req = urllib.request.Request( req = urllib.request.Request(
f"https://api.github.com/repos/pluralkit/pluralkit/check-runs", f"https://api.github.com/repos/pluralkit/pluralkit/check-runs",
@ -63,7 +66,7 @@ def report_status(sha, name, start_time, exit=None):
except urllib.error.HTTPError as e: except urllib.error.HTTPError as e:
response_code = e.getcode() response_code = e.getcode()
response_data = e.read() response_data = e.read()
print(f"{response_code} failed to update status {name}: {response_data}") print(f"{response_code} failed to update status {data}: {response_data}")
global global_fail global global_fail
global_fail = True global_fail = True
@ -84,7 +87,7 @@ def main():
return 1 return 1
data = json.loads(dispatch_data) data = json.loads(dispatch_data)
print("running {dispatch_data}") print(f"running {dispatch_data}")
time_started = datetime.datetime.now(tz=datetime.timezone.utc).isoformat(timespec='seconds') time_started = datetime.datetime.now(tz=datetime.timezone.utc).isoformat(timespec='seconds')
report_status(data['sha'], data["action"], time_started) report_status(data['sha'], data["action"], time_started)