diff --git a/githubissues/main.go b/githubissues/main.go index 40d7dab5..20928dc5 100644 --- a/githubissues/main.go +++ b/githubissues/main.go @@ -151,13 +151,10 @@ func (g *githubissuesNotifier) SendNotification(ctx context.Context, build *cbpb func GetGithubRepo(configGithubRepo string, build *cbpb.Build) string { if build.Substitutions != nil { - if repo, ok := build.Substitutions["REPO_NAME"]; ok { - // split and only take repo name as last two parts - // e.g. "github.com/GoogleCloudPlatform/cloud-build-notifiers" -> "GoogleCloudPlatform/cloud-build-notifiers" - parts := strings.Split(repo, "/") - if len(parts) > 2 { - return strings.Join(parts[len(parts)-2:], "/") - } + if repo, ok := build.Substitutions["REPO_FULL_NAME"]; ok { + // return repo full name if it's available + // e.g. "GoogleCloudPlatform/cloud-build-notifiers" + return repo } } return configGithubRepo diff --git a/githubissues/main_test.go b/githubissues/main_test.go index 21e3c7cb..420b5bfa 100644 --- a/githubissues/main_test.go +++ b/githubissues/main_test.go @@ -165,7 +165,7 @@ func TestConfigs(t *testing.T) { func TestGetGithubRepo(t *testing.T) { // test GetGithubRepo method build := &cbpb.Build{ - Substitutions: map[string]string{"REPO_NAME": "github.com/somename/somerepo"}, + Substitutions: map[string]string{"REPO_FULL_NAME": "somename/somerepo"}, } if got, want := GetGithubRepo("config/repo", build), "somename/somerepo"; got != want { t.Errorf("got %q, want %q", got, want)