Skip to content

Commit

Permalink
Merge pull request #669 from WildGums/GitHubSync/20231219-124453
Browse files Browse the repository at this point in the history
GitHubSync update
  • Loading branch information
GeertvanHorrik authored Dec 19, 2023
2 parents b273c1d + 3234605 commit 9a86a54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
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

0 comments on commit 9a86a54

Please sign in to comment.