mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-24 21:46:52 +01:00
Nullify GitHubClientFactory
This commit is contained in:
@@ -9,8 +9,6 @@ using Octokit;
|
||||
using Tgstation.Server.Host.Configuration;
|
||||
using Tgstation.Server.Host.System;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tgstation.Server.Host.Utils.GitHub
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@@ -78,7 +76,7 @@ namespace Tgstation.Server.Host.Utils.GitHub
|
||||
/// </summary>
|
||||
/// <param name="accessToken">Optional access token to use as credentials.</param>
|
||||
/// <returns>The <see cref="GitHubClient"/> for the given <paramref name="accessToken"/>.</returns>
|
||||
GitHubClient GetOrCreateClient(string accessToken)
|
||||
GitHubClient GetOrCreateClient(string? accessToken)
|
||||
{
|
||||
GitHubClient client;
|
||||
bool cacheHit;
|
||||
@@ -99,10 +97,11 @@ namespace Tgstation.Server.Host.Utils.GitHub
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
if (!cacheHit)
|
||||
{
|
||||
var product = assemblyInformationProvider.ProductInfoHeaderValue.Product!;
|
||||
client = new GitHubClient(
|
||||
new ProductHeaderValue(
|
||||
assemblyInformationProvider.ProductInfoHeaderValue.Product.Name,
|
||||
assemblyInformationProvider.ProductInfoHeaderValue.Product.Version));
|
||||
product.Name,
|
||||
product.Version));
|
||||
|
||||
if (accessToken != null)
|
||||
client.Credentials = new Credentials(accessToken);
|
||||
|
||||
Reference in New Issue
Block a user