diff --git a/api/queries_repo.go b/api/queries_repo.go index f72277fb2..28d4374b7 100644 --- a/api/queries_repo.go +++ b/api/queries_repo.go @@ -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() diff --git a/pkg/cmd/pr/shared/params.go b/pkg/cmd/pr/shared/params.go index e53ad7a06..ba9901f77 100644 --- a/pkg/cmd/pr/shared/params.go +++ b/pkg/cmd/pr/shared/params.go @@ -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 }