Skip to content

Commit a0c13f5

Browse files
Pigbibicodex
andcommitted
fix: read environment-scoped service targets
Co-Authored-By: Codex <noreply@openai.com>
1 parent 12ca837 commit a0c13f5

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

.github/workflows/manual-strategy-switch.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,21 @@ jobs:
229229
run: |
230230
set -euo pipefail
231231
output_file="${RUNNER_TEMP}/existing-service-targets.json"
232-
python - <<'PY' "${TARGET_REPOSITORY}" "${output_file}"
232+
target_environment=""
233+
if [ "${VARIABLE_SCOPE}" = "environment" ]; then
234+
target_environment="${GITHUB_ENVIRONMENT_NAME:-${TARGET_NAME}}"
235+
fi
236+
python - <<'PY' "${TARGET_REPOSITORY}" "${output_file}" "${target_environment}"
233237
import json
234238
import subprocess
235239
import sys
236240
237-
repo, output_path = sys.argv[1], sys.argv[2]
241+
repo, output_path, environment = sys.argv[1:4]
242+
command = ["gh", "variable", "list", "--repo", repo, "--json", "name,value"]
243+
if environment:
244+
command.extend(["--env", environment])
238245
raw = subprocess.check_output(
239-
["gh", "variable", "list", "--repo", repo, "--json", "name,value"],
246+
command,
240247
text=True,
241248
)
242249
variables = json.loads(raw)

python/tests/test_runtime_settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ def test_manual_switch_platform_choices_cover_supported_platforms(self):
9292

9393
self.assertEqual(set(platform_choices), set(runtime_settings.SUPPORTED_PLATFORMS))
9494

95+
def test_manual_switch_reads_ibkr_targets_from_selected_environment_scope(self):
96+
workflow = (ROOT / ".github/workflows/manual-strategy-switch.yml").read_text(encoding="utf-8")
97+
98+
assert 'if [ "${VARIABLE_SCOPE}" = "environment" ]; then' in workflow
99+
assert 'target_environment="${GITHUB_ENVIRONMENT_NAME:-${TARGET_NAME}}"' in workflow
100+
assert 'command.extend(["--env", environment])' in workflow
101+
95102
def test_live_candidate_queue_lists_profiles_needing_promotion_review(self):
96103
catalog = [
97104
{

0 commit comments

Comments
 (0)