From cde8faaf57dce3e7ff51f15dc270802d4f4bc233 Mon Sep 17 00:00:00 2001 From: Ken Kaizu Date: Mon, 21 Nov 2022 07:18:34 +0900 Subject: [PATCH] Fix GitHub app uses slug as user name to work --hide-prev-plan-comments correctly (#2697) * Fix GitHub app uses slug as user name * Update server/events/vcs/github_credentials_test.go Co-authored-by: PePe Amengual Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com> Co-authored-by: PePe Amengual --- server/events/vcs/github_credentials.go | 2 +- server/events/vcs/github_credentials_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/events/vcs/github_credentials.go b/server/events/vcs/github_credentials.go index d70376c14..ef64cbce7 100644 --- a/server/events/vcs/github_credentials.go +++ b/server/events/vcs/github_credentials.go @@ -108,7 +108,7 @@ func (c *GithubAppCredentials) GetUser() (string, error) { } // Currently there is no way to get the bot's login info, so this is a // hack until Github exposes that. - return fmt.Sprintf("%s[bot]", app.GetName()), nil + return fmt.Sprintf("%s[bot]", app.GetSlug()), nil } // GetToken returns a fresh installation token. diff --git a/server/events/vcs/github_credentials_test.go b/server/events/vcs/github_credentials_test.go index 08b3de617..1150194d0 100644 --- a/server/events/vcs/github_credentials_test.go +++ b/server/events/vcs/github_credentials_test.go @@ -30,7 +30,7 @@ func TestGithubClient_GetUser_AppSlug(t *testing.T) { user, err := appCreds.GetUser() Ok(t, err) - Assert(t, user == "Octocat App[bot]", "user should not empty") + Assert(t, user == "octoapp[bot]", "user should not be empty") } func TestGithubClient_AppAuthentication(t *testing.T) {