From 91f95d02312b394a63fda43910dee3298615025b Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sat, 15 Jul 2017 22:30:24 -0700 Subject: [PATCH] finishing off ProcessPushPayload in Github Scm. --- lib/scm/github.go | 8 +++++--- lib/utils/git_test.go | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/scm/github.go b/lib/scm/github.go index 3360b55..2de133c 100644 --- a/lib/scm/github.go +++ b/lib/scm/github.go @@ -13,6 +13,7 @@ import ( "capsulecd/lib/errors" "fmt" "net/url" + "capsulecd/lib/utils" ) type scmGithub struct { @@ -145,11 +146,12 @@ func (g *scmGithub) ProcessPushPayload(payload *ScmPayload) error { // clone the merged branch // https://sethvargo.com/checkout-a-github-pull-request/ // https://coderwall.com/p/z5rkga/github-checkout-a-pull-request-as-a-branch -// @source_git_local_path = CapsuleCD::GitUtils.clone(@source_git_parent_path, @source_git_head_info['repo']['name'], @source_git_remote) -// CapsuleCD::GitUtils.checkout(@source_git_local_path, @source_git_head_info['repo']['sha1']) + gitLocalPath, cerr := utils.GitClone(g.options.GitParentPath, g.options.GitHeadInfo.Repo.Name, g.options.GitRemote) + if(cerr != nil){return cerr} + g.options.GitLocalPath = gitLocalPath - return nil + return utils.GitCheckout(g.options.GitLocalPath, g.options.GitHeadInfo.Sha) } // all capsule CD processing will be kicked off via a payload. In Github's case, the payload is the pull request data. diff --git a/lib/utils/git_test.go b/lib/utils/git_test.go index f4e40a1..72a8835 100644 --- a/lib/utils/git_test.go +++ b/lib/utils/git_test.go @@ -181,7 +181,6 @@ func TestGitGenerateChangelog(t *testing.T) { 2016-02-28T06:52Z | d4b8c3b5 | Update README.md | Jason Kulatunga 2016-02-28T00:01Z | d0d3fc8f | (v0.1.10) Automated packaging of release by CapsuleCD | CapsuleCD `, changelog) - } func deleteTestRepo(testRepoDirectory string){