From 7574ee728674b859bd42ecf5c5b012a7bc0a9796 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 11:02:05 +0000 Subject: [PATCH 1/2] Initial plan From 58961573adc76b759d8a375555961453ae25b5ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 11:03:26 +0000 Subject: [PATCH 2/2] remove archive check before triggering download workflow when data is outdated Agent-Logs-Url: https://github.com/mtransitapps/commons/sessions/cd9d2ddd-690f-44ac-b9dd-30187bcf3868 Co-authored-by: mmathieum <177998+mmathieum@users.noreply.github.com> --- .../workflows/mt-check-data-outdated.yml | 63 +------------------ 1 file changed, 2 insertions(+), 61 deletions(-) diff --git a/shared-overwrite/.github/workflows/mt-check-data-outdated.yml b/shared-overwrite/.github/workflows/mt-check-data-outdated.yml index 26023c0f..400ab6d1 100644 --- a/shared-overwrite/.github/workflows/mt-check-data-outdated.yml +++ b/shared-overwrite/.github/workflows/mt-check-data-outdated.yml @@ -94,66 +94,7 @@ jobs: DIFF_SEC=$((NOW_TIMESTAMP_SEC - DEPLOYED_LAST_DEPARTURE_SEC)) DIFF_DAYS=$((DIFF_SEC / 86400)) echo ">> Deployed data has expired! Last departure was ${DIFF_DAYS} days ago." - echo ">> Data is OUTDATED. Sync recommended. Looking for available archives..." - - # Check archive directory for available data - ARCHIVE_DIR="agency-parser/archive" - echo "> Archive dir: '${ARCHIVE_DIR}'" - - if [[ ! -d "${ARCHIVE_DIR}" ]]; then - echo ">> No archive directory found. Cannot check for newer data." - echo ">> Data is up-to-date (based on deployed data only)." - exit 0 # No archive, so we can't determine if newer data available - fi - - # Find archives (requires bash 4+ for mapfile, available on ubuntu-latest) - mapfile -t ARCHIVES < <(find "${ARCHIVE_DIR}" -name "*.zip" -type f 2>/dev/null | sort) - echo "> Archives found: ${#ARCHIVES[@]}" - - if [[ "${#ARCHIVES[@]}" -eq 0 ]]; then - echo ">> No archives available. Data cannot be updated." - echo ">> Data is up-to-date (based on deployed data only)." - exit 0 - fi - - # Check if any archive has data that extends beyond the deployed last departure - ARCHIVE_HAS_NEWER_DATA=false - - for ARCHIVE in "${ARCHIVES[@]}"; do - ARCHIVE_BASENAME=$(basename "${ARCHIVE}") - ARCHIVE_BASENAME_NO_EXT="${ARCHIVE_BASENAME%.*}" - - # Validate archive date format - if ! [[ "${ARCHIVE_BASENAME_NO_EXT}" =~ ^[0-9]{8}-[0-9]{8}$ ]]; then - echo "> Archive: ${ARCHIVE_BASENAME}" - echo " - WARNING: Archive filename doesn't match expected format (YYYYMMDD-YYYYMMDD.zip)" - continue - fi - - ARCHIVE_START_DATE=${ARCHIVE_BASENAME_NO_EXT:0:8} - ARCHIVE_END_DATE=${ARCHIVE_BASENAME_NO_EXT:9:8} - echo "> Archive: ${ARCHIVE_BASENAME} (${ARCHIVE_START_DATE} to ${ARCHIVE_END_DATE})" - - # Convert archive end date (YYYYMMDD) to timestamp at end of day (GNU date, available on ubuntu-latest) - ARCHIVE_END_TIMESTAMP=$(date -d "${ARCHIVE_END_DATE} 23:59:59" +%s 2>/dev/null) - - if [[ -n "${ARCHIVE_END_TIMESTAMP}" ]]; then - echo " - Archive end timestamp: ${ARCHIVE_END_TIMESTAMP}" - # If archive has data beyond what's currently deployed, we need to sync - if [[ "${ARCHIVE_END_TIMESTAMP}" -gt "${DEPLOYED_LAST_DEPARTURE_SEC}" ]]; then - echo " - Archive has newer data than deployed!" - ARCHIVE_HAS_NEWER_DATA=true - break # Found newer data, no need to check other archives - fi - fi - done - - # Determine if data is outdated based on archive availability - if [[ "${ARCHIVE_HAS_NEWER_DATA}" == true ]]; then - echo ">> Archive contains newer data. Data is OUTDATED. Triggering mt-download-data.yml workflow..." - gh workflow run mt-download-data.yml - else - echo ">> Data is up-to-date." - fi + echo ">> Data is OUTDATED. Triggering mt-download-data.yml workflow..." + gh workflow run mt-download-data.yml env: GH_TOKEN: ${{ secrets.MT_PAT }}