Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions internal/publish/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ func Package(githubUser string, githubClient *github.Client, fork, skipPullReque
logger.Debugf("Copy sources of the latest package revision to index")
}

fmt.Println("Check if pull request is already open")
alreadyOpen, err := checkIfPullRequestAlreadyOpen(githubClient, *m)
if err != nil {
return errors.Wrapf(err, "can't check if pull request is already open")
}
if alreadyOpen {
fmt.Println("Pull request with package update is already open")
return nil
}

destination, err := copyLatestRevisionIfAvailable(r, latestRevision, stage, m)
if err != nil {
return errors.Wrap(err, "can't copy sources of latest package revision")
Expand All @@ -100,16 +110,6 @@ func Package(githubUser string, githubClient *github.Client, fork, skipPullReque
return nil
}

fmt.Println("Check if pull request is already open")
alreadyOpen, err := checkIfPullRequestAlreadyOpen(githubClient, *m)
if err != nil {
return errors.Wrapf(err, "can't check if pull request is already open")
}
if alreadyOpen {
fmt.Println("Pull request with package update is already open")
return nil
}

fmt.Println("Open new pull request")
err = openPullRequest(githubClient, githubUser, destination, *m, commitHash, fork)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/publish/pull_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func checkIfPullRequestAlreadyOpen(githubClient *github.Client, manifest package

for _, item := range searchResults.Issues {
if *item.Title == expectedTitle {
logger.Debugf("Found pull request: ", *item.HTMLURL)
logger.Debugf("Found pull request: %s", *item.HTMLURL)
return true, nil
}
}
Expand Down