Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add prlink to cli output #457

Merged
merged 3 commits into from
Jul 12, 2021
Merged

add prlink to cli output #457

merged 3 commits into from
Jul 12, 2021

Conversation

J-Thompson12
Copy link
Contributor

addresses https://app.zenhub.com/workspaces/weaveworks-foss-603cb6b1d4dff9000e242dc4/issues/weaveworks/weave-gitops/374 outputs the pr link to the cli output.

use the cli output to merge the pr in the test

@@ -260,11 +260,11 @@ func UploadDeployKey(owner, repoName string, deployKey []byte) error {
func DeployKeyExists(owner, repoName string) (bool, error) {
return gitProviderHandler.(GitProviderHandler).DeployKeyExists(owner, repoName)
}
func CreatePullRequestToUserRepo(userRepRef gitprovider.UserRepositoryRef, targetBranch string, newBranch string, files []gitprovider.CommitFile, commitMessage string, prTitle string, prDescription string) error {
func CreatePullRequestToUserRepo(userRepRef gitprovider.UserRepositoryRef, targetBranch string, newBranch string, files []gitprovider.CommitFile, commitMessage string, prTitle string, prDescription string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are way too many arguments to this function. Anything more than 4 tends to get unwieldy. I realize it was set up that way before this PR, just wanted to comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this func returns a string, I don't know what the string represents. I assume a URL in this case? Can we return a golang url.Url type? Or possibly the pull request object that is being created?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can absolutely return the pr object and get the url string in add. Unfortunately I dont think I can lower the number of arguments. Gitproviders needs all of that info and I could take some of that info and generate it in common but that could limit future functionality.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I would say that would be a separate PR to make that change.

I would use a struct as an argument like we do on AddParams to make it a little more understandable.

pkg/services/app/add.go Outdated Show resolved Hide resolved
test/acceptance/test/add_tests.go Show resolved Hide resolved
provider, err := GithubProvider()
if err != nil {
return err
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapped error here would help with debugging.

pkg/services/app/add_test.go Show resolved Hide resolved
@J-Thompson12 J-Thompson12 merged commit 42a658e into main Jul 12, 2021
@J-Thompson12 J-Thompson12 deleted the pr-link branch August 9, 2021 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants