Skip to content

Commit b780391

Browse files
committed
fix: harden Roblox API dump sync to skip missing builds
The sync step was using latest.json to resolve the build GUID, but the latest build's files are often missing from the archive. curl without --fail silently wrote the 404 response body as the dump, corrupting it. Now uses metadata.json to find the latest GUID that actually has Full-API-Dump.json available, adds curl -f, and validates JSON output. Also restores the dump from the last available build.
1 parent 9901136 commit b780391

2 files changed

Lines changed: 208419 additions & 5 deletions

File tree

.github/workflows/sync-sources.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,27 @@ jobs:
5555
5656
- name: Sync Roblox API dump
5757
run: |
58-
echo "Resolving latest build GUID..."
59-
GUID=$(curl -s "https://raw.githubusercontent.com/RobloxAPI/build-archive/master/data/production/latest.json" | jq -r '.GUID')
58+
BASE="https://raw.githubusercontent.com/RobloxAPI/build-archive/master/data/production"
59+
60+
echo "Resolving latest build GUID with Full-API-Dump.json available..."
61+
GUID=$(curl -sf "$BASE/metadata.json" | jq -r '
62+
[.Missing // {} | to_entries[] | select(.value | index("Full-API-Dump.json")) | .key] as $missing |
63+
[.Builds[] | select(.GUID as $g | $missing | index($g) | not)] | last | .GUID
64+
')
65+
66+
if [ -z "$GUID" ] || [ "$GUID" = "null" ]; then
67+
echo "::error::Failed to resolve a valid build GUID from metadata.json"
68+
exit 1
69+
fi
6070
echo "GUID: $GUID"
6171
6272
mkdir -p roblox-api
63-
curl -sL "https://raw.githubusercontent.com/RobloxAPI/build-archive/master/data/production/builds/$GUID/Full-API-Dump.json" \
64-
-o roblox-api/Full-API-Dump.json
73+
curl -sfL "$BASE/builds/$GUID/Full-API-Dump.json" -o roblox-api/Full-API-Dump.json
74+
75+
if ! jq empty roblox-api/Full-API-Dump.json 2>/dev/null; then
76+
echo "::error::Downloaded Full-API-Dump.json is not valid JSON"
77+
exit 1
78+
fi
6579
echo "Done: roblox-api/Full-API-Dump.json"
6680
6781
- name: Commit and push

0 commit comments

Comments
 (0)