Skip to content

Instantly share code, notes, and snippets.

@y-yagi
Last active May 20, 2016 06:41
Show Gist options
  • Save y-yagi/4887ccddf4c41064f91434a8941c3c78 to your computer and use it in GitHub Desktop.
Save y-yagi/4887ccddf4c41064f91434a8941c3c78 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"os/exec"
"strings"
)
func run() {
repository := os.Getenv("REPOSITORY")
if repository == "" {
fmt.Println("Please set 'REPOSITORY'")
os.Exit(1)
}
os.Mkdir("tmp", 0777)
os.Chdir("tmp")
_, err := exec.Command("git", "clone", repository).Output()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
repositoryPaths := strings.Split(repository, "/")
repositoryPath := repositoryPaths[len(repositoryPaths)-1]
os.Chdir(repositoryPath)
_, err = exec.Command("./gradlew", "dependencyUpdates", "-Drevision=release", "-DoutputFormatter=json").Output()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
// TODO: remove tmp directory
fmt.Println("gradle-update-notification finish")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment