Skip to content

Commit 52c3d69

Browse files
committed
(build) cleanup GitHubCredentials
1 parent c75423f commit 52c3d69

File tree

5 files changed

+5
-17
lines changed

5 files changed

+5
-17
lines changed

build/common/Utilities/Models.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public record NugetPackage(string PackageName, FilePath FilePath, bool IsChocoPa
77

88
public record CodeCovCredentials(string Token);
99

10-
public record GitHubCredentials(string UserName, string Token);
10+
public record GitHubCredentials(string Token);
1111

1212
public record NugetCredentials(string ApiKey, string ApiUrl);
1313

build/docs/Tasks/PublishDocs.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,14 @@ private static void PublishDocumentation(BuildContext context)
109109

110110
private static void PublishToGitHub(BuildContext context, DirectoryPath publishFolder, string publishBranchName)
111111
{
112-
var username = context.Credentials?.GitHub?.UserName;
113-
if (string.IsNullOrEmpty(username))
114-
{
115-
throw new InvalidOperationException("Could not resolve Github username.");
116-
}
117-
118112
var token = context.Credentials?.GitHub?.Token;
119113
if (string.IsNullOrEmpty(token))
120114
{
121115
throw new InvalidOperationException("Could not resolve Github token.");
122116
}
123117

124118
context.Information("Pushing all changes...");
125-
context.GitPush(publishFolder, username, token, publishBranchName);
119+
context.GitPush(publishFolder, Constants.RepoOwner, token, publishBranchName);
126120
}
127121
}
128122
}

build/docs/Utilities/Credentials.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ public class Credentials
99
public GitHubCredentials? GitHub { get; private set; }
1010
public static Credentials GetCredentials(ICakeContext context) => new()
1111
{
12-
GitHub = new GitHubCredentials(
13-
context.EnvironmentVariable("GITHUB_USERNAME"),
14-
context.EnvironmentVariable("GITHUB_TOKEN")),
12+
GitHub = new GitHubCredentials(context.EnvironmentVariable("GITHUB_TOKEN")),
1513
};
1614
}
1715
}

build/publish/Utilities/Credentials.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ public class Credentials
1212

1313
public static Credentials GetCredentials(ICakeContext context) => new()
1414
{
15-
GitHub = new GitHubCredentials(
16-
context.EnvironmentVariable("GITHUB_USERNAME"),
17-
context.EnvironmentVariable("GITHUB_TOKEN")),
15+
GitHub = new GitHubCredentials(context.EnvironmentVariable("GITHUB_TOKEN")),
1816

1917
Nuget = new NugetCredentials(
2018
context.EnvironmentVariable("NUGET_API_KEY"),

build/release/Utilities/Credentials.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ public class Credentials
99
public GitHubCredentials? GitHub { get; private set; }
1010
public static Credentials GetCredentials(ICakeContext context) => new()
1111
{
12-
GitHub = new GitHubCredentials(
13-
context.EnvironmentVariable("GITHUB_USERNAME"),
14-
context.EnvironmentVariable("GITHUB_TOKEN")),
12+
GitHub = new GitHubCredentials(context.EnvironmentVariable("GITHUB_TOKEN")),
1513
};
1614
}
1715
}

0 commit comments

Comments
 (0)