diff --git a/tools/devops/utils.csx b/tools/devops/utils.csx index b34747b27b..03e0a2dd43 100644 --- a/tools/devops/utils.csx +++ b/tools/devops/utils.csx @@ -34,14 +34,23 @@ string DownloadWithGithubAuth (string uri) string manifest_url = null; string GetManifestUrl (string hash) { - if (manifest_url == null) { - var url = $"https://api.github.com/repos/xamarin/xamarin-macios/statuses/{hash}"; + var page = 1; + var hasContent = true; + while (manifest_url == null && hasContent) { + var url = $"https://api.github.com/repos/xamarin/xamarin-macios/statuses/{hash}?page={page}"; var json = JToken.Parse (DownloadWithGithubAuth (url)); - var value = (JValue) ((JArray) json).Where ((v) => v ["context"].ToString () == "manifest").Select ((v) => v ["target_url"]).FirstOrDefault (); - manifest_url = (string) value?.Value; - if (manifest_url == null) - throw new Exception ($"Could not find the manifest for {hash}. Is the commit already built by CI?"); + var statuses = (JValue) ((JArray) json); + hasContent &= statuses.HasValues; + if (hasContent) { + var value = statuses.Where ((v) => v ["context"].ToString () == "manifest").Select ((v) => v ["target_url"]).FirstOrDefault (); + manifest_url = (string) value?.Value; + } + page++; } + + if (manifest_url == null) + throw new Exception ($"Could not find the manifest for {hash}. Is the commit already built by CI?"); + return manifest_url; }