Test
This commit is contained in:
@@ -98,29 +98,29 @@ IGetWorkflowRunsApiResponse getWorkflowRunsApiResponse = await repositoryApi.Get
|
|||||||
if (!getWorkflowRunsApiResponse.TryOk(out ActionWorkflowRunsResponse workflowRunResponse))
|
if (!getWorkflowRunsApiResponse.TryOk(out ActionWorkflowRunsResponse workflowRunResponse))
|
||||||
{
|
{
|
||||||
Console.WriteLine("Failed to retrieve workflow runs.");
|
Console.WriteLine("Failed to retrieve workflow runs.");
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionWorkflowRun? actionWorkflowRun = workflowRunResponse.WorkflowRuns.FirstOrDefault(w => workflowRegex.IsMatch(w.Path.Split('@')[0]));
|
ActionWorkflowRun? actionWorkflowRun = workflowRunResponse.WorkflowRuns.FirstOrDefault(w => workflowRegex.IsMatch(w.Path.Split('@')[0]));
|
||||||
if (actionWorkflowRun is null)
|
if (actionWorkflowRun is null)
|
||||||
{
|
{
|
||||||
Console.WriteLine("No matching workflow run found.");
|
Console.WriteLine("No matching workflow run found.");
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
IGetArtifactsOfRunApiResponse artifacts = await repositoryApi.GetArtifactsOfRunOrDefaultAsync(repoOwner, repoName, (int)actionWorkflowRun.Id!, string.Empty, CancellationToken.None);
|
IGetArtifactsOfRunApiResponse artifacts = await repositoryApi.GetArtifactsOfRunOrDefaultAsync(repoOwner, repoName, (int)actionWorkflowRun.Id!, string.Empty, CancellationToken.None);
|
||||||
if (!artifacts.TryOk(out ActionArtifactsResponse artifactsResponse))
|
if (!artifacts.TryOk(out ActionArtifactsResponse artifactsResponse))
|
||||||
{
|
{
|
||||||
Console.WriteLine("Failed to retrieve artifacts.");
|
Console.WriteLine("Failed to retrieve artifacts.");
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
if (artifactsResponse.Artifacts.Count == 0)
|
ActionArtifact[] artifactsToDownload = artifactsResponse.Artifacts.Where(a => artifactRegex.IsMatch(a.Name)).ToArray();
|
||||||
|
if (artifactsToDownload.Length is 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine("No artifacts found for the specified workflow run.");
|
Console.WriteLine("No artifacts found for the specified workflow run.");
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<ActionArtifact> artifactsToDownload = artifactsResponse.Artifacts.Where(a => artifactRegex.IsMatch(a.Name));
|
|
||||||
|
|
||||||
Console.WriteLine("Downloading artifacts:");
|
Console.WriteLine("Downloading artifacts:");
|
||||||
foreach (ActionArtifact artifact in artifactsToDownload)
|
foreach (ActionArtifact artifact in artifactsToDownload)
|
||||||
@@ -157,3 +157,5 @@ foreach (ActionArtifact artifact in artifactsToDownload)
|
|||||||
File.Delete(fileName);
|
File.Delete(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
Reference in New Issue
Block a user