Skip to content

Commit 1f32c7b

Browse files
committed
chore: address feedback on Buildkite results skill
1 parent c97d31b commit 1f32c7b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.agents/skills/buildkite-get-results/scripts/get_buildkite_results.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ def fetch_buildkite_data(build_url):
6363
print(f"Error fetching data from {json_url}: {e}", file=sys.stderr)
6464
return None
6565

66-
# If jobs is empty but statistics says there are jobs, try to fetch from /data/jobs.json
66+
# If jobs list is truncated or empty but statistics says there are more jobs,
67+
# try to fetch from /data/jobs.json
6768
jobs = data.get("jobs", [])
6869
jobs_count = data.get("statistics", {}).get("jobs_count", 0)
6970

70-
if not jobs and jobs_count > 0:
71+
if len(jobs) < jobs_count:
7172
# Try fetching from /data/jobs.json
7273
# Build URL might have .json already from the check above
7374
base_url = build_url
@@ -79,10 +80,10 @@ def fetch_buildkite_data(build_url):
7980
with urllib.request.urlopen(jobs_url) as response:
8081
if response.status == 200:
8182
jobs_data = json.loads(response.read().decode())
82-
if isinstance(jobs_data, dict) and "records" in jobs_data:
83-
data["jobs"] = jobs_data["records"]
84-
elif isinstance(jobs_data, list):
83+
if isinstance(jobs_data, list):
8584
data["jobs"] = jobs_data
85+
elif isinstance(jobs_data, dict) and "records" in jobs_data:
86+
data["jobs"] = jobs_data["records"]
8687
except Exception as e:
8788
print(f"Warning: Could not fetch detailed jobs from {jobs_url}: {e}", file=sys.stderr)
8889

0 commit comments

Comments
 (0)