diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 396b6d9..1eccff4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,6 @@ on: - 'requirements.txt' - 'scripts/**' - 'container_overrides/**' - - '.github/workflows/main.yml' # Runs automatically every day at 0:00 UTC (8:00 AM Beijing Time) schedule: - cron: '0 0 * * *' @@ -331,18 +330,7 @@ jobs: gcloud secrets versions list "${secret_name}" \ --project "${GCP_PROJECT_ID}" \ --format=json \ - | python -c 'import json,sys -rows = json.load(sys.stdin) -active = [ - int(row["name"].rsplit("/", 1)[-1]) - for row in rows - if row.get("state") in {"ENABLED", "DISABLED"} -] -if len(active) <= 1: - sys.exit(0) -keep = max(active) -print("\n".join(str(version) for version in active if version != keep)) -' + | python3 -c 'import json, sys; rows = json.load(sys.stdin); active = [int(row["name"].rsplit("/", 1)[-1]) for row in rows if row.get("state") in {"ENABLED", "DISABLED"}]; keep = max(active) if active else None; print("\n".join(str(version) for version in active if version != keep))' )" while IFS= read -r version; do diff --git a/tests/test_workflow_shared_config.sh b/tests/test_workflow_shared_config.sh index a375f50..96ff9c6 100644 --- a/tests/test_workflow_shared_config.sh +++ b/tests/test_workflow_shared_config.sh @@ -56,7 +56,7 @@ grep -Fq 'gcloud secrets versions add "${secret_name}"' "$workflow_file" grep -Fq "paths:" "$workflow_file" grep -Fq "'scripts/**'" "$workflow_file" grep -Fq "'container_overrides/**'" "$workflow_file" -grep -Fq "'.github/workflows/main.yml'" "$workflow_file" +! grep -Fq "'.github/workflows/main.yml'" "$workflow_file" grep -Fq 'DEPLOY_MODE="full"' "$workflow_file" grep -Fq 'if [ "${DEPLOY_EVENT_NAME}" = "schedule" ]; then' "$workflow_file" grep -Fq 'elif [ "${DEPLOY_EVENT_NAME}" = "workflow_dispatch" ]; then' "$workflow_file"