Skip to content

Commit

Permalink
Auto update packages repo
Browse files Browse the repository at this point in the history
  • Loading branch information
xtuc committed May 25, 2020
1 parent 35c006b commit 0a608fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/autoupdate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ func main() {
fmt.Println("Running in debug mode")
}

util.UpdateGitRepo(context.Background(), PACKAGES_PATH)

for _, f := range getPackages(context.Background()) {
ctx := util.ContextWithName(f)
pckg, err := packages.ReadPackageJSON(ctx, path.Join(PACKAGES_PATH, f))
Expand Down
15 changes: 15 additions & 0 deletions util/git.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package util

import (
"context"
"os/exec"
)

func UpdateGitRepo(ctx context.Context, gitpath string) {
args := []string{"pull", "--rebase"}

cmd := exec.Command("git", args...)
cmd.Dir = gitpath
Debugf(ctx, "run %s\n", cmd)
CheckCmd(cmd.CombinedOutput())
}

0 comments on commit 0a608fc

Please sign in to comment.