@@ -54,14 +54,41 @@ jobs:
5454 env :
5555 MOCK_SF_PORT : ' 8888'
5656
57- - name : Register fake org 'dev1' with SF CLI
57+ - name : Create fake SF CLI auth for org alias 'dev1'
5858 run : |
5959 sleep 1
60- echo "00D000000000001AAA!fakeAccessTokenForCITesting" | \
61- sf org login access-token \
62- --instance-url http://localhost:8888 \
63- --alias dev1 \
64- --no-prompt
60+ python - <<'PYEOF'
61+ import json, pathlib
62+ home = pathlib.Path.home()
63+
64+ # Auth file — @salesforce/core reads ~/.sfdx/<username>.json on Linux
65+ # (plain-text storage, no OS keychain involved on CI runners)
66+ sfdx_dir = home / ".sfdx"
67+ sfdx_dir.mkdir(exist_ok=True)
68+ auth = {
69+ "accessToken": "00D000000000001AAA!fakeTokenForCITesting",
70+ "instanceUrl": "http://localhost:8888",
71+ "loginUrl": "https://login.salesforce.com",
72+ "orgId": "00D000000000001AAA",
73+ "userId": "005000000000001AAA",
74+ "username": "dev1@example.com",
75+ "clientId": "PlatformCLI",
76+ "isDevHub": False,
77+ "isSandbox": False,
78+ "created": "2024-01-01T00:00:00.000Z",
79+ "createdOrgInstance": "CS1",
80+ }
81+ (sfdx_dir / "dev1@example.com.json").write_text(json.dumps(auth, indent=2))
82+
83+ # Alias mapping — write to both locations for compat across sf versions
84+ alias_data = {"orgs": {"dev1": "dev1@example.com"}}
85+ sf_dir = home / ".sf"
86+ sf_dir.mkdir(exist_ok=True)
87+ (sf_dir / "alias.json").write_text(json.dumps(alias_data))
88+ (sfdx_dir / "alias.json").write_text(json.dumps(alias_data))
89+
90+ print("Fake SF CLI org auth written to ~/.sfdx/dev1@example.com.json")
91+ PYEOF
6592
6693 # ── Script: init ──────────────────────────────────────────────────────────
6794
0 commit comments