refactor(api): use constant for Copilot login

This commit is contained in:
Kynan Ware 2025-05-16 12:28:46 -06:00
parent 3a8cdda148
commit a28e2d8784
2 changed files with 7 additions and 2 deletions

View file

@ -1183,6 +1183,11 @@ func RepoProjects(client *Client, repo ghrepo.Interface) ([]RepoProject, error)
return projects, nil
}
// Expected login for Copilot when retrieved as an Actor
// This is returned from assignable actors and issue/pr assigned actors.
// We use this to check if the actor is Copilot.
var CopilotActorLogin = "copilot-swe-agent"
type AssignableActor interface {
DisplayName() string
ID() string
@ -1241,7 +1246,7 @@ func NewAssignableBot(id, login string) AssignableBot {
}
func (b AssignableBot) DisplayName() string {
if b.login == "copilot-swe-agent" {
if b.login == CopilotActorLogin {
return "Copilot (AI)"
}
return b.Login()

View file

@ -322,7 +322,7 @@ func NewCopilotReplacer() *CopilotReplacer {
func (r *CopilotReplacer) replace(handle string) string {
if strings.EqualFold(handle, "@copilot") {
return "copilot-swe-agent"
return api.CopilotActorLogin
}
return handle
}