From b5db262d1fb6812f44d84d9c9fbbe018b250707f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aaron-=E7=9F=B3=E9=9B=AA=E5=B2=A9?= <43869308+Aaron3963@users.noreply.github.com> Date: Tue, 11 Aug 2026 10:24:45 +0800 Subject: [PATCH 1/4] feat: force send notice for test action trials --- .github/workflows/actions.yml | 8 ++++++++ CEACStatusBot/notification/manager.py | 21 ++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 8b155de..ebc56e1 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -5,6 +5,12 @@ on: branches: - main workflow_dispatch: + inputs: + force_notify: + description: 'Force send notification' + required: false + default: false + type: boolean schedule: - cron: '17 * * * *' # At 00:00 on Monday @@ -43,6 +49,7 @@ jobs: PASSPORT_NUMBER: ${{ secrets.PASSPORT_NUMBER }} SURNAME: ${{ secrets.SURNAME }} TIMEZONE: ${{ secrets.TIMEZONE }} + # ACTIVE_HOURS: ${{ secrets.ACTIVE_HOURS }} FROM: ${{ secrets.FROM }} TO: ${{ secrets.TO }} PASSWORD: ${{ secrets.PASSWORD }} @@ -51,6 +58,7 @@ jobs: TG_CHAT_ID: ${{ secrets.TG_CHAT_ID }} GH_TOKEN: ${{ secrets.GH_TOKEN }} GITHUB_REPOSITORY: ${{ github.repository }} + FORCE_NOTIFY: ${{ github.event.inputs.force_notify || 'false' }} run: uv run trigger.py - name: Upload status artifact diff --git a/CEACStatusBot/notification/manager.py b/CEACStatusBot/notification/manager.py index d96db2d..1164064 100644 --- a/CEACStatusBot/notification/manager.py +++ b/CEACStatusBot/notification/manager.py @@ -59,8 +59,17 @@ def send(self) -> None: # Load the previous statuses from the file statuses = self.__load_statuses() - # Check if the current status is different from the last recorded status - if not statuses or current_status != statuses[-1].get("status", None) or current_last_updated != statuses[-1].get("last_updated", None): + force_notify = os.getenv("FORCE_NOTIFY", "").lower() in ("1", "true", "yes") + # Check if the current status is different from the last recorded status, + # or if notifications are forced for manual testing + status_changed = ( + not statuses + or current_status != statuses[-1].get("status", None) + or current_last_updated != statuses[-1].get("last_updated", None) + ) + if force_notify or status_changed: + if force_notify: + print("FORCE_NOTIFY set - sending notification despite unchanged status.") self.__save_current_status(current_status, current_last_updated) self.__send_notifications(res) else: @@ -74,11 +83,9 @@ def __load_statuses(self) -> list: def __save_current_status(self, status: str, last_updated: str) -> None: statuses = self.__load_statuses() - statuses.append({ - "status": status, - "last_updated": last_updated, - "date": datetime.datetime.now().isoformat() - }) + statuses.append( + {"status": status, "last_updated": last_updated, "date": datetime.datetime.now().isoformat()} + ) with open(self.__status_file, "w") as file: json.dump({"statuses": statuses}, file) From 90f686abefb0a1f09fa4856aeb02e4f115ea31cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aaron-=E7=9F=B3=E9=9B=AA=E5=B2=A9?= <43869308+Aaron3963@users.noreply.github.com> Date: Tue, 11 Aug 2026 10:25:30 +0800 Subject: [PATCH 2/4] Update on trigger time --- .github/workflows/actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index ebc56e1..9f6bf38 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -12,7 +12,7 @@ on: default: false type: boolean schedule: - - cron: '17 * * * *' # At 00:00 on Monday + - cron: '10 0,6,12 * * *' # 08:10 / 14:10 / 20:10 UTC+8 daily (10-min offset to avoid :00 peak) jobs: build: From 2215a1b02f1f8ccb74df7f63d4ee2626db41e1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aaron-=E7=9F=B3=E9=9B=AA=E5=B2=A9?= <43869308+Aaron3963@users.noreply.github.com> Date: Tue, 11 Aug 2026 10:32:30 +0800 Subject: [PATCH 3/4] Update action dependencies --- .github/workflows/actions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 9f6bf38..7c921fb 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -19,15 +19,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo content - uses: actions/checkout@v2 + uses: actions/checkout@v7 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v7 with: python-version: '3.10' - name: Cache Python packages - uses: actions/cache@v3 + uses: actions/cache@v6 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }} From f56c60f11e536f0391f5b154bcc85f15a28b6edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aaron-=E7=9F=B3=E9=9B=AA=E5=B2=A9?= <43869308+Aaron3963@users.noreply.github.com> Date: Tue, 11 Aug 2026 10:37:26 +0800 Subject: [PATCH 4/4] Update more dependencies --- .github/workflows/actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 7c921fb..a6ebe82 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -62,7 +62,7 @@ jobs: run: uv run trigger.py - name: Upload status artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: status-artifact path: status_record.json