Merge pull request #8630 from xamarin/cadsit-page-github-manifest-download
page through github statuses for manifest URL
This commit is contained in:
Коммит
39aa2ff42a
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче