RayMelius Claude Sonnet 4.6 commited on
Commit
23664b9
Β·
1 Parent(s): b1722ec

Split GITHUB_REPO into GITHUB_OWNER + GITHUB_REPO_NAME (no slash)

Browse files

Render and some other platforms reject '/' in env var values.
Code now reads GITHUB_OWNER + GITHUB_REPO_NAME and combines them;
falls back to the old GITHUB_REPO for any existing setups.
render.yaml updated to use the two-part variables.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. render.yaml +3 -1
  2. src/soci/api/server.py +9 -3
render.yaml CHANGED
@@ -24,5 +24,7 @@ services:
24
  sync: false
25
  - key: GITHUB_TOKEN
26
  sync: false
27
- - key: GITHUB_REPO
 
 
28
  sync: false
 
24
  sync: false
25
  - key: GITHUB_TOKEN
26
  sync: false
27
+ - key: GITHUB_OWNER # e.g. Bonum (no slash)
28
+ sync: false
29
+ - key: GITHUB_REPO_NAME # e.g. Soci (no slash)
30
  sync: false
src/soci/api/server.py CHANGED
@@ -134,12 +134,16 @@ async def load_state_from_github(data_dir: Path) -> bool:
134
 
135
  Env vars:
136
  GITHUB_TOKEN β€” personal access token with repo read/write
137
- GITHUB_REPO β€” "owner/repo" e.g. "alice/soci"
 
 
138
  GITHUB_STATE_BRANCH β€” branch name (default: "simulation-state")
139
  GITHUB_STATE_FILE β€” path inside repo (default: "state/autosave.json")
140
  """
141
  token = os.environ.get("GITHUB_TOKEN", "")
142
- repo = os.environ.get("GITHUB_REPO", "")
 
 
143
  if not token or not repo:
144
  return False
145
  path = os.environ.get("GITHUB_STATE_FILE", "state/autosave.json")
@@ -174,7 +178,9 @@ async def load_state_from_github(data_dir: Path) -> bool:
174
  async def save_state_to_github(data_dir: Path) -> bool:
175
  """Push autosave.json to the simulation-state branch (never touches master)."""
176
  token = os.environ.get("GITHUB_TOKEN", "")
177
- repo = os.environ.get("GITHUB_REPO", "")
 
 
178
  if not token or not repo:
179
  return False
180
  path = os.environ.get("GITHUB_STATE_FILE", "state/autosave.json")
 
134
 
135
  Env vars:
136
  GITHUB_TOKEN β€” personal access token with repo read/write
137
+ GITHUB_OWNER β€” repo owner e.g. "alice" (preferred, no slash)
138
+ GITHUB_REPO_NAME β€” repo name e.g. "soci" (preferred, no slash)
139
+ GITHUB_REPO β€” "owner/repo" fallback for existing setups
140
  GITHUB_STATE_BRANCH β€” branch name (default: "simulation-state")
141
  GITHUB_STATE_FILE β€” path inside repo (default: "state/autosave.json")
142
  """
143
  token = os.environ.get("GITHUB_TOKEN", "")
144
+ owner = os.environ.get("GITHUB_OWNER", "")
145
+ repo_name = os.environ.get("GITHUB_REPO_NAME", "")
146
+ repo = f"{owner}/{repo_name}" if owner and repo_name else os.environ.get("GITHUB_REPO", "")
147
  if not token or not repo:
148
  return False
149
  path = os.environ.get("GITHUB_STATE_FILE", "state/autosave.json")
 
178
  async def save_state_to_github(data_dir: Path) -> bool:
179
  """Push autosave.json to the simulation-state branch (never touches master)."""
180
  token = os.environ.get("GITHUB_TOKEN", "")
181
+ owner = os.environ.get("GITHUB_OWNER", "")
182
+ repo_name = os.environ.get("GITHUB_REPO_NAME", "")
183
+ repo = f"{owner}/{repo_name}" if owner and repo_name else os.environ.get("GITHUB_REPO", "")
184
  if not token or not repo:
185
  return False
186
  path = os.environ.get("GITHUB_STATE_FILE", "state/autosave.json")