Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHubSync update #671

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions deployment/cake/issuetrackers-github.cake
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ public class GitHubIssueTracker : IIssueTracker
{
BuildContext = buildContext;

UserName = buildContext.BuildServer.GetVariable("GitHubUserName", showValue: true);
ApiKey = buildContext.BuildServer.GetVariable("GitHubApiKey", showValue: false);
OwnerName = buildContext.BuildServer.GetVariable("GitHubOwnerName", buildContext.General.Copyright.Company, showValue: true);
ProjectName = buildContext.BuildServer.GetVariable("GitHubProjectName", buildContext.General.Solution.Name, showValue: true);

if (!string.IsNullOrWhiteSpace(UserName) &&
!string.IsNullOrWhiteSpace(ApiKey) &&
if (!string.IsNullOrWhiteSpace(ApiKey) &&
!string.IsNullOrWhiteSpace(OwnerName) &&
!string.IsNullOrWhiteSpace(ProjectName))
{
Expand All @@ -24,7 +22,6 @@ public class GitHubIssueTracker : IIssueTracker

public BuildContext BuildContext { get; private set; }

public string UserName { get; set; }
public string ApiKey { get; set; }
public string OwnerName { get; set; }
public string ProjectName { get; set; }
Expand Down
10 changes: 4 additions & 6 deletions deployment/cake/sourcecontrol-github.cake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#addin "nuget:?package=Cake.GitHub&version=0.1.0"
#addin "nuget:?package=Octokit&version=9.0.0"
#addin "nuget:?package=Octokit&version=9.0.0"

//-------------------------------------------------------------

Expand All @@ -9,13 +9,11 @@ public class GitHubSourceControl : ISourceControl
{
BuildContext = buildContext;

UserName = buildContext.BuildServer.GetVariable("GitHubUserName", buildContext.General.Repository.Username, showValue: true);
ApiKey = buildContext.BuildServer.GetVariable("GitHubApiKey", buildContext.General.Repository.Password, showValue: false);
OwnerName = buildContext.BuildServer.GetVariable("GitHubOwnerName", buildContext.General.Copyright.Company, showValue: true);
ProjectName = buildContext.BuildServer.GetVariable("GitHubProjectName", buildContext.General.Solution.Name, showValue: true);

if (!string.IsNullOrWhiteSpace(UserName) &&
!string.IsNullOrWhiteSpace(ApiKey) &&
if (!string.IsNullOrWhiteSpace(ApiKey) &&
!string.IsNullOrWhiteSpace(OwnerName) &&
!string.IsNullOrWhiteSpace(ProjectName))
{
Expand All @@ -25,7 +23,6 @@ public class GitHubSourceControl : ISourceControl

public BuildContext BuildContext { get; private set; }

public string UserName { get; set; }
public string ApiKey { get; set; }
public string OwnerName { get; set; }
public string ProjectName { get; set; }
Expand Down Expand Up @@ -66,7 +63,8 @@ public class GitHubSourceControl : ISourceControl

var commitSha = BuildContext.General.Repository.CommitId;

BuildContext.CakeContext.GitHubStatus(UserName, ApiKey, OwnerName, ProjectName, commitSha, new GitHubStatusSettings
// Note: UserName is not really required, use string.Empty, then only api key is needed
BuildContext.CakeContext.GitHubStatus(string.Empty, ApiKey, OwnerName, ProjectName, commitSha, new GitHubStatusSettings
{
State = state,
TargetUrl = null,// "url-to-build-server",
Expand Down