refactor(api): use constant for Copilot login
This commit is contained in:
parent
3a8cdda148
commit
a28e2d8784
2 changed files with 7 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue