Merge pull request #8630 from xamarin/cadsit-page-github-manifest-download

page through github statuses for manifest URL
This commit is contained in:
Connor Adsit 2020-05-20 15:03:13 -04:00 коммит произвёл GitHub
Родитель 4cc33f4d80 4bd68fd653
Коммит 39aa2ff42a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@ -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;
}