Last active
May 20, 2016 06:41
-
-
Save y-yagi/4887ccddf4c41064f91434a8941c3c78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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