[Fix] Fixes an issue where the runner application response deserialization would fail

This commit is contained in:
Matisse Hack
2023-05-09 07:43:43 -07:00
committed by GitHub
parent e032611e54
commit 9adcf16362
5 changed files with 42 additions and 19 deletions

View File

@@ -133,7 +133,7 @@ namespace Octokit.Tests.Clients
await client.ListAllRunnerApplicationsForEnterprise("fake");
connection.Received().GetAll<IReadOnlyList<RunnerApplication>>(
connection.Received().GetAll<RunnerApplication>(
Arg.Is<Uri>(u => u.ToString() == "enterprises/fake/actions/runners/downloads"), Args.ApiOptions);
}
@@ -167,7 +167,7 @@ namespace Octokit.Tests.Clients
await client.ListAllRunnerApplicationsForOrganization("fake");
connection.Received().GetAll<IReadOnlyList<RunnerApplication>>(
connection.Received().GetAll<RunnerApplication>(
Arg.Is<Uri>(u => u.ToString() == "orgs/fake/actions/runners/downloads"), Args.ApiOptions);
}
@@ -201,7 +201,7 @@ namespace Octokit.Tests.Clients
await client.ListAllRunnerApplicationsForRepository("fake", "repo");
connection.Received().GetAll<IReadOnlyList<RunnerApplication>>(
connection.Received().GetAll<RunnerApplication>(
Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/actions/runners/downloads"), Args.ApiOptions);
}

View File

@@ -153,9 +153,7 @@ namespace Octokit
{
Ensure.ArgumentNotNullOrEmptyString(enterprise, nameof(enterprise));
var results = await ApiConnection.GetAll<IReadOnlyList<RunnerApplication>>(ApiUrls.ActionsListRunnerApplicationsForEnterprise(enterprise), options).ConfigureAwait(false);
return results.SelectMany(x => x).ToList();
return await ApiConnection.GetAll<RunnerApplication>(ApiUrls.ActionsListRunnerApplicationsForEnterprise(enterprise), options).ConfigureAwait(false);
}
/// <summary>
@@ -184,9 +182,7 @@ namespace Octokit
{
Ensure.ArgumentNotNullOrEmptyString(organization, nameof(organization));
var results = await ApiConnection.GetAll<IReadOnlyList<RunnerApplication>>(ApiUrls.ActionsListRunnerApplicationsForOrganization(organization), options).ConfigureAwait(false);
return results.SelectMany(x => x).ToList();
return await ApiConnection.GetAll<RunnerApplication>(ApiUrls.ActionsListRunnerApplicationsForOrganization(organization), options).ConfigureAwait(false);
}
/// <summary>
@@ -219,9 +215,7 @@ namespace Octokit
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(repo, nameof(repo));
var results = await ApiConnection.GetAll<IReadOnlyList<RunnerApplication>>(ApiUrls.ActionsListRunnerApplicationsForRepository(owner, repo), options).ConfigureAwait(false);
return results.SelectMany(x => x).ToList();
return await ApiConnection.GetAll<RunnerApplication>(ApiUrls.ActionsListRunnerApplicationsForRepository(owner, repo), options).ConfigureAwait(false);
}
/// <summary>

View File

@@ -15,7 +15,7 @@ namespace Octokit
Id = id;
}
public Runner(long id, string name, string os, string status, bool busy, List<Label> labels)
public Runner(long id, string name, string os, string status, bool busy, List<RunnerLabel> labels)
{
Id = id;
Name = name;
@@ -30,7 +30,7 @@ namespace Octokit
public string Os { get; private set; }
public string Status { get; private set; }
public bool Busy { get; private set; }
public IReadOnlyList<Label> Labels { get; private set; }
public IReadOnlyList<RunnerLabel> Labels { get; private set; }
internal string DebuggerDisplay
{

View File

@@ -8,25 +8,27 @@ namespace Octokit
{
public RunnerApplication() { }
public RunnerApplication(string os, string architecture, string downloadUrl, string fileName)
public RunnerApplication(string os, string architecture, string downloadUrl, string filename, string tempDownloadToken)
{
Os = os;
Architecture = architecture;
DownloadUrl = downloadUrl;
FileName = fileName;
Filename = filename;
TempDownloadToken = tempDownloadToken;
}
public string Os { get; private set; }
public string Architecture { get; private set; }
public string DownloadUrl { get; private set; }
public string FileName { get; private set; }
public string Filename { get; private set; }
public string TempDownloadToken { get; private set; }
internal string DebuggerDisplay
{
get
{
return string.Format("Os: {0}; Architecture: {1}; DownloadUrl: {2}; FileName: {3};",
Os, Architecture, DownloadUrl, FileName);
return string.Format("Os: {0}; Architecture: {1}; DownloadUrl: {2}; Filename: {3}; TempDownloadToken: {4}",
Os, Architecture, DownloadUrl, Filename, TempDownloadToken);
}
}
}

View File

@@ -0,0 +1,27 @@
using System.Diagnostics;
using System.Globalization;
namespace Octokit
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class RunnerLabel
{
public RunnerLabel() { }
public RunnerLabel(long id, string name, string type)
{
Id = id;
Name = name;
Type = type;
}
public long Id { get; private set; }
public string Name { get; private set; }
public string Type { get; private set; }
internal string DebuggerDisplay
{
get { return string.Format(CultureInfo.InvariantCulture, "Id: {0}; Name: {1}; Type: {2};", Id, Name, Type); }
}
}
}