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 <jose.amengual@gmail.com>

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
This commit is contained in:
Ken Kaizu
2022-11-21 07:18:34 +09:00
committed by GitHub
parent 949ee3fa5f
commit cde8faaf57
2 changed files with 2 additions and 2 deletions

View File

@@ -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.

View File

@@ -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) {