Trace x-github-request-id when download action tarball. (#2755)

This commit is contained in:
Tingluo Huang
2023-08-15 19:00:54 -04:00
committed by GitHub
parent d88823c634
commit 4f40f29cff
5 changed files with 32 additions and 20 deletions

View File

@@ -1,4 +1,6 @@
using System;
using System.Linq;
using System.Net.Http.Headers;
namespace GitHub.Runner.Sdk
{
@@ -48,5 +50,15 @@ namespace GitHub.Runner.Sdk
return credUri.Uri;
}
public static string GetGitHubRequestId(HttpResponseHeaders headers)
{
if (headers != null &&
headers.TryGetValues("x-github-request-id", out var headerValues))
{
return headerValues.FirstOrDefault();
}
return string.Empty;
}
}
}