Merge pull request '接受 Actions Variables 中格式化的项目回调 JSON' (#3) from codex/foundry-project-config into main
Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
+24
-1
@@ -8,13 +8,36 @@ origin=https://api.foundry.entroia.com
|
||||
candidate=foundry-core-candidate
|
||||
network=endoleap-dev_default
|
||||
|
||||
for name in GOOGLE_CLIENT_ID GOOGLE_CLIENT_SECRET FOUNDRY_PROJECTS; do
|
||||
for name in GOOGLE_CLIENT_ID GOOGLE_CLIENT_SECRET; do
|
||||
value=${!name-}
|
||||
if [[ -z "$value" || "$value" == *$'\n'* || "$value" == *$'\r'* ]]; then
|
||||
printf 'Missing or invalid %s\n' "$name" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
# Accept formatted JSON from Actions Variables and never print its contents.
|
||||
FOUNDRY_PROJECTS=$(python3 - <<'PYCONFIG'
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
raw = os.environ.get("FOUNDRY_PROJECTS", "")
|
||||
if not raw.strip():
|
||||
sys.exit("FOUNDRY_PROJECTS was not injected from Actions Variables")
|
||||
try:
|
||||
projects = json.loads(raw)
|
||||
except ValueError:
|
||||
sys.exit("FOUNDRY_PROJECTS must be valid JSON")
|
||||
if not isinstance(projects, dict) or not projects or any(
|
||||
not isinstance(callback, str) or not callback.strip()
|
||||
for callback in projects.values()
|
||||
):
|
||||
sys.exit("FOUNDRY_PROJECTS must map project names to callback URLs")
|
||||
print(json.dumps(projects, separators=(",", ":")))
|
||||
PYCONFIG
|
||||
)
|
||||
export FOUNDRY_PROJECTS
|
||||
|
||||
test -s "$foundry/database.env"
|
||||
docker network inspect "$network" >/dev/null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user