Skip to content

Commit 9a448c9

Browse files
feat: add travis-com flag
Closes #16
1 parent e994de0 commit 9a448c9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cmd/semantic-release/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func main() {
5353
updateFile := flag.String("update", "", "updates the version of a certain file")
5454
gheHost := flag.String("ghe-host", os.Getenv("GITHUB_ENTERPRISE_HOST"), "github enterprise host")
5555
isPrerelease := flag.Bool("prerelease", false, "flags the release as a prerelease")
56+
isTravisCom := flag.Bool("travis-com", false, "force semantic-release to use the travis-ci.com API endpoint")
5657
flag.Parse()
5758

5859
if *showVersion {
@@ -81,6 +82,9 @@ func main() {
8182
defaultBranch, isPrivate, err := repo.GetInfo()
8283
exitIfError(err)
8384
logger.Println("found default branch: " + defaultBranch)
85+
if isPrivate {
86+
logger.Println("repo is private")
87+
}
8488

8589
currentBranch := condition.GetCurrentBranch()
8690
if currentBranch == "" {
@@ -103,7 +107,7 @@ func main() {
103107

104108
if !*noci {
105109
logger.Println("running CI condition...")
106-
exitIfError(condition.Travis(*token, defaultBranch, isPrivate))
110+
exitIfError(condition.Travis(*token, defaultBranch, isPrivate || *isTravisCom))
107111
}
108112

109113
logger.Println("getting latest release...")

condition/travis.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ func Travis(token, defaultBranch string, private bool) error {
4646
logger.Printf("Using Travis CI enterprise host: %s\n", travisHost)
4747
endpoint = fmt.Sprintf("https://%s/api/", travisHost)
4848
} else if private {
49-
logger.Println("repo is private")
5049
endpoint = travis.TRAVIS_API_PRO_URL
5150
}
5251

0 commit comments

Comments
 (0)