Reset state on CTRL+C exit.
@@ -85,8 +85,9 @@ if ENABLE_USB_LIGHT_MESSAGES:
print("Opening serial port.")
mSerial = serial.Serial(serial_port, baud_rate)
-print("Starting Github Actions Status Watcher")
+print("Starting Github Actions Status Watcher.")
print("Press Ctrl-C to Exit")
+try:
while True:
print("Fetching workflow run status.")
response = requests.get(f"{REPO_WORKFLOW_URL}?per_page=1", headers=headers)
@@ -139,6 +140,11 @@ while True:
if ENABLE_USB_LIGHT_MESSAGES:
print("Sending serial command 'RED_OFF'.")
send_command(mSerial, RED_OFF)
+
else:
print("Already followed the current run.")
time.sleep(POLL_DELAY)
+
+except KeyboardInterrupt:
+ print("\nExiting Github Actions Status Watcher.")
+ reset_state()
