From d772a9487d0d2e4922575f20b6ed9d29e88f3279 Mon Sep 17 00:00:00 2001 From: Sian Teesdale <43341988+sianteesdale@users.noreply.github.com> Date: Wed, 3 Jun 2026 09:56:22 +0100 Subject: [PATCH 1/5] Change batch assign scheduling to 7pm UTC --- .github/workflows/batch-assign.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/batch-assign.yml b/.github/workflows/batch-assign.yml index 8a42c1e6..f890f67a 100644 --- a/.github/workflows/batch-assign.yml +++ b/.github/workflows/batch-assign.yml @@ -2,11 +2,11 @@ name: Batch Assign Unknown Entities on: schedule: - - cron: "0 20 * * 1" # Monday – odp - - cron: "0 20 * * 2" # Tuesday – mandated - - cron: "0 20 * * 3" # Wednesday – odp - - cron: "0 20 * * 4" # Thursday – single-source - - cron: "0 20 * * 5" # Friday – odp + - cron: "0 19 * * 1" # Monday – odp + - cron: "0 19 * * 2" # Tuesday – mandated + - cron: "0 19 * * 3" # Wednesday – odp + - cron: "0 19 * * 4" # Thursday – single-source + - cron: "0 19 * * 5" # Friday – odp repository_dispatch: types: [auto-batch-assign] From adee78f090ffb98237c1df3186c9bc54111ece99 Mon Sep 17 00:00:00 2001 From: Sian Teesdale <43341988+sianteesdale@users.noreply.github.com> Date: Wed, 3 Jun 2026 10:08:36 +0100 Subject: [PATCH 2/5] Add Slack notifications for failed runs --- .github/workflows/batch-assign.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/batch-assign.yml b/.github/workflows/batch-assign.yml index f890f67a..e773dace 100644 --- a/.github/workflows/batch-assign.yml +++ b/.github/workflows/batch-assign.yml @@ -1,5 +1,8 @@ name: Batch Assign Unknown Entities +env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + on: schedule: - cron: "0 19 * * 1" # Monday – odp @@ -191,3 +194,11 @@ jobs: issue_summary.csv invalid_uri_issues.csv issue_summary_full.csv + + - name: Notify slack failure + if: failure() && github.ref == 'refs/heads/main' + uses: digital-land/github-action-slack-notify-build@main + with: + channel: planning-data-alerts + status: FAILED + color: danger From 016293e801d18cc7edcd6a34dd071c646c9cf0e7 Mon Sep 17 00:00:00 2001 From: Sian Teesdale <43341988+sianteesdale@users.noreply.github.com> Date: Wed, 3 Jun 2026 10:26:15 +0100 Subject: [PATCH 3/5] Handle batching exit --- .github/workflows/batch-assign.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/batch-assign.yml b/.github/workflows/batch-assign.yml index e773dace..08982dd1 100644 --- a/.github/workflows/batch-assign.yml +++ b/.github/workflows/batch-assign.yml @@ -167,10 +167,12 @@ jobs: CURRENT_BATCH="${START_BATCH:-1}" while true; do + set +e python3 /tmp/batch_assign_entities.py "${ARGS[@]}" \ --batch-size "$BATCH_SIZE" \ --start-batch "$CURRENT_BATCH" EXIT=$? + set -e if [ $EXIT -eq 2 ]; then echo "All batches complete." break From cffac30a2e6958627d561cfd3cc41f05cb72bd0b Mon Sep 17 00:00:00 2001 From: Sian Teesdale <43341988+sianteesdale@users.noreply.github.com> Date: Wed, 3 Jun 2026 10:31:29 +0100 Subject: [PATCH 4/5] Move the batch assign py script to .github/scripts --- {bin => .github/scripts}/batch_assign_entities.py | 0 .github/workflows/batch-assign.yml | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename {bin => .github/scripts}/batch_assign_entities.py (100%) diff --git a/bin/batch_assign_entities.py b/.github/scripts/batch_assign_entities.py similarity index 100% rename from bin/batch_assign_entities.py rename to .github/scripts/batch_assign_entities.py diff --git a/.github/workflows/batch-assign.yml b/.github/workflows/batch-assign.yml index 08982dd1..2b181421 100644 --- a/.github/workflows/batch-assign.yml +++ b/.github/workflows/batch-assign.yml @@ -156,7 +156,7 @@ jobs: if [ "${BATCH_SIZE:-0}" -gt 0 ]; then # Save the script before git checkout may overwrite it with an older version - cp bin/batch_assign_entities.py /tmp/batch_assign_entities.py + cp .github/scripts/batch_assign_entities.py /tmp/batch_assign_entities.py # Switch to config-manager-update so pipeline files accumulate correctly across batches if git show-ref --verify --quiet refs/heads/config-manager-update; then @@ -183,7 +183,7 @@ jobs: CURRENT_BATCH=$(( CURRENT_BATCH + 1 )) done else - python3 bin/batch_assign_entities.py "${ARGS[@]}" + python3 .github/scripts/batch_assign_entities.py "${ARGS[@]}" fi - name: Upload artifact From 568bd489f3588485aaa5e4e218c348bcc18a2a32 Mon Sep 17 00:00:00 2001 From: Sian Teesdale <43341988+sianteesdale@users.noreply.github.com> Date: Wed, 3 Jun 2026 10:37:01 +0100 Subject: [PATCH 5/5] Update tests with new script location --- tests/integration/test_batch_assign_entities.py | 2 +- tests/integration/test_process_csv.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_batch_assign_entities.py b/tests/integration/test_batch_assign_entities.py index 80d5d27e..7278f684 100644 --- a/tests/integration/test_batch_assign_entities.py +++ b/tests/integration/test_batch_assign_entities.py @@ -8,7 +8,7 @@ import pandas as pd import pytest -sys.path.insert(0, str(Path(__file__).parent.parent.parent / "bin")) +sys.path.insert(0, str(Path(__file__).parent.parent.parent / ".github/scripts")) from batch_assign_entities import ( _collect_validation_rows, diff --git a/tests/integration/test_process_csv.py b/tests/integration/test_process_csv.py index 4d2a2ec1..d27e76d4 100644 --- a/tests/integration/test_process_csv.py +++ b/tests/integration/test_process_csv.py @@ -1,7 +1,10 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent.parent / ".github/scripts")) import requests import pandas as pd import pytest -import bin.batch_assign_entities as batch_assign_entities +import batch_assign_entities @pytest.fixture def setup_test_path(monkeypatch, tmp_path):