diff --git a/.github/workflows/nexus-trusted-traveler-scheduler-1.yml b/.github/workflows/nexus-trusted-traveler-scheduler-1.yml index 8e126b0a..b2c87647 100644 --- a/.github/workflows/nexus-trusted-traveler-scheduler-1.yml +++ b/.github/workflows/nexus-trusted-traveler-scheduler-1.yml @@ -6,7 +6,7 @@ name: "nexus 1" on: # Push is for testing only to allow you to test this workflow without # a merge and just a push. -# push: + push: # pull_request: # types: # - closed diff --git a/nexus-global-entry/trusted-traveler-scheduler/trusted-traveler-scheduler/src/notifcation_handler.py b/nexus-global-entry/trusted-traveler-scheduler/trusted-traveler-scheduler/src/notifcation_handler.py index c7f30f81..a0c358c4 100644 --- a/nexus-global-entry/trusted-traveler-scheduler/trusted-traveler-scheduler/src/notifcation_handler.py +++ b/nexus-global-entry/trusted-traveler-scheduler/trusted-traveler-scheduler/src/notifcation_handler.py @@ -52,15 +52,25 @@ def send_notification(self, body: str, level: int = 1) -> None: title = "Trusted Traveler Scheduler" - apobj = apprise.Apprise(self.notification_urls) - result = apobj.notify(title=title, body=body, body_format=apprise.NotifyFormat.TEXT) - - # If you encounter Apprise errors, https://github.com/caronc/apprise/wiki/Development_LogCapture - # may be useful. - if result is None: - print('{datetime.today():%Y/%m/%d %H:%M:%S}: error: No notifications sent (configuration error)') - elif result is False: - print('{datetime.today():%Y/%m/%d %H:%M:%S}: error: At least 1 notification failed to send') + pattern = r"Sun|Fri|Sat" + match = re.search(pattern, body) + print("GarDebug: in sending notification") + + if match: + print(f"GarDebug: Sending notification: {body}") + + apobj = apprise.Apprise(self.notification_urls) + result = apobj.notify(title=title, body=body, body_format=apprise.NotifyFormat.TEXT) + + # If you encounter Apprise errors, https://github.com/caronc/apprise/wiki/Development_LogCapture + # may be useful. + if result is None: + print('{datetime.today():%Y/%m/%d %H:%M:%S}: error: No notifications sent (configuration error)') + elif result is False: + print('{datetime.today():%Y/%m/%d %H:%M:%S}: error: At least 1 notification failed to send') + + else: + print(f"GarDebug: Skipping notification: {body}") def new_appointment(self, location_id: int, appointments: List[Schedule]) -> None: """