Repository: gembaadvantage/uplift
Pull request #138 (2022-04-05 12:17:29)

fix: remove hardcoded codecommit repository name from links


Patch:
diff --git a/internal/git/utils.go b/internal/git/utils.go
index e2f402e..c657e28 100644
--- a/internal/git/utils.go
+++ b/internal/git/utils.go
@@ -151,7 +151,7 @@ func Remote() (Repository, error) {
 		if err != nil {
 			return Repository{}, err
 		}
-		browse = fmt.Sprintf("https://%s.console.aws.amazon.com/codesuite/codecommit/repositories/repository", t.Region)
+		browse = fmt.Sprintf("https://%s.console.aws.amazon.com/codesuite/codecommit/repositories/%s", t.Region, t.Repository)
 	}
 
 	return Repository{


Test patch:
diff --git a/internal/git/utils_test.go b/internal/git/utils_test.go
index 9aa6882..7f9d65a 100644
--- a/internal/git/utils_test.go
+++ b/internal/git/utils_test.go
@@ -54,75 +54,75 @@ func TestRemote(t *testing.T) {
 	}{
 		{
 			name:      "GitHubSSH",
-			url:       "git@github.com:owner/repository.git",
+			url:       "git@github.com:owner/testing1.git",
 			scm:       GitHub,
 			owner:     "owner",
-			repo:      "repository",
-			cloneURL:  "https://github.com/owner/repository",
-			browseURL: "https://github.com/owner/repository",
+			repo:      "testing1",
+			cloneURL:  "https://github.com/owner/testing1",
+			browseURL: "https://github.com/owner/testing1",
 		},
 		{
 			name:      "GitHubHTTPS",
-			url:       "https://github.com/owner/repository.git",
+			url:       "https://github.com/owner/testing2.git",
 			scm:       GitHub,
 			owner:     "owner",
-			repo:      "repository",
-			cloneURL:  "https://github.com/owner/repository",
-			browseURL: "https://github.com/owner/repository",
+			repo:      "testing2",
+			cloneURL:  "https://github.com/owner/testing2",
+			browseURL: "https://github.com/owner/testing2",
 		},
 		{
 			name:      "GitLabSSH",
-			url:       "git@gitlab.com:owner/repository.git",
+			url:       "git@gitlab.com:owner/testing3.git",
 			scm:       GitLab,
 			owner:     "owner",
-			repo:      "repository",
-			cloneURL:  "https://gitlab.com/owner/repository",
-			browseURL: "https://gitlab.com/owner/repository",
+			repo:      "testing3",
+			cloneURL:  "https://gitlab.com/owner/testing3",
+			browseURL: "https://gitlab.com/owner/testing3",
 		},
 		{
 			name:      "GitLabHTTPS",
-			url:       "https://gitlab.com/owner/repository.git",
+			url:       "https://gitlab.com/owner/testing4.git",
 			scm:       GitLab,
 			owner:     "owner",
-			repo:      "repository",
-			cloneURL:  "https://gitlab.com/owner/repository",
-			browseURL: "https://gitlab.com/owner/repository",
+			repo:      "testing4",
+			cloneURL:  "https://gitlab.com/owner/testing4",
+			browseURL: "https://gitlab.com/owner/testing4",
 		},
 		{
 			name:      "GitLabUsernamePasswordHTTPS",
-			url:       "https://username@password:gitlab.com/owner/repository.git",
+			url:       "https://username@password:gitlab.com/owner/testing5.git",
 			scm:       GitLab,
 			owner:     "owner",
-			repo:      "repository",
-			cloneURL:  "https://gitlab.com/owner/repository",
-			browseURL: "https://gitlab.com/owner/repository",
+			repo:      "testing5",
+			cloneURL:  "https://gitlab.com/owner/testing5",
+			browseURL: "https://gitlab.com/owner/testing5",
 		},
 		{
 			name:      "CodeCommitSSH",
-			url:       "ssh://git-codecommit.eu-west-1.amazonaws.com/v1/repos/repository",
+			url:       "ssh://git-codecommit.eu-west-1.amazonaws.com/v1/repos/testing6",
 			scm:       CodeCommit,
 			owner:     "",
-			repo:      "repository",
-			cloneURL:  "https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/repository",
-			browseURL: "https://eu-west-1.console.aws.amazon.com/codesuite/codecommit/repositories/repository",
+			repo:      "testing6",
+			cloneURL:  "https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/testing6",
+			browseURL: "https://eu-west-1.console.aws.amazon.com/codesuite/codecommit/repositories/testing6",
 		},
 		{
 			name:      "CodeCommitHTTPS",
-			url:       "https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/repository",
+			url:       "https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/testing7",
 			scm:       CodeCommit,
 			owner:     "",
-			repo:      "repository",
-			cloneURL:  "https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/repository",
-			browseURL: "https://eu-west-1.console.aws.amazon.com/codesuite/codecommit/repositories/repository",
+			repo:      "testing7",
+			cloneURL:  "https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/testing7",
+			browseURL: "https://eu-west-1.console.aws.amazon.com/codesuite/codecommit/repositories/testing7",
 		},
 		{
 			name:      "CodeCommitGRC",
-			url:       "codecommit::eu-west-1://profile@repository",
+			url:       "codecommit::eu-west-1://profile@testing8",
 			scm:       CodeCommit,
 			owner:     "",
-			repo:      "repository",
-			cloneURL:  "https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/repository",
-			browseURL: "https://eu-west-1.console.aws.amazon.com/codesuite/codecommit/repositories/repository",
+			repo:      "testing8",
+			cloneURL:  "https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/testing8",
+			browseURL: "https://eu-west-1.console.aws.amazon.com/codesuite/codecommit/repositories/testing8",
 		},
 	}
 	for _, tt := range tests {