Skip to content

Commit

Permalink
Merge pull request #22 from sambaiz/feature/failed_to_checkout
Browse files Browse the repository at this point in the history
fix problem to fail checkout
  • Loading branch information
sambaiz authored Dec 27, 2019
2 parents a71304e + 134ef48 commit a315683
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion tasks/operation/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ func (c *Client) Merge(path, branch string) error {

// Checkout file of branch
func (c *Client) Checkout(path, fileName, branch string) error {
cmd := exec.Command("git", "checkout", branch, fileName)
cmd := exec.Command("git", "fetch", "origin", branch)
cmd.Dir = path
if out, err := cmd.CombinedOutput(); err != nil || cmd.ProcessState.ExitCode() != 0 {
return fmt.Errorf("git fetch failed: %s %v", string(out), err)
}
cmd = exec.Command("git", "checkout", fmt.Sprintf("origin/%s", branch), fileName)
cmd.Dir = path
if out, err := cmd.CombinedOutput(); err != nil || cmd.ProcessState.ExitCode() != 0 {
return fmt.Errorf("git checkout %s of %s failed: %s %v", fileName, branch, string(out), err)
Expand Down
4 changes: 2 additions & 2 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Metadata:
ReadmeUrl: README.md
Labels: ['cloudformation', 'cdk']
HomePageUrl: https://github.com/sambaiz/cdkbot
SemanticVersion: 0.4.1
SemanticVersion: 0.4.2
SourceCodeUrl: https://github.com/sambaiz/cdkbot

Parameters:
Expand Down Expand Up @@ -147,7 +147,7 @@ Resources:
Memory: '1024'
ContainerDefinitions:
- Name: 'cdkbot-operation'
Image: 'sambaiz/cdkbot-operation:0.4.1'
Image: 'sambaiz/cdkbot-operation:0.4.2'
Essential: 'true'
LogConfiguration:
LogDriver: 'awslogs'
Expand Down

0 comments on commit a315683

Please sign in to comment.