@@ -8,6 +8,7 @@ import { COPILOT_ACCOUNTS, IComment } from '../common/comment';
88import { Disposable } from '../common/lifecycle' ;
99import Logger from '../common/logger' ;
1010import { Remote } from '../common/remote' ;
11+ import { ITelemetry } from '../common/telemetry' ;
1112import { ClosedEvent , CrossReferencedEvent , EventType , TimelineEvent } from '../common/timelineEvent' ;
1213import { compareIgnoreCase , formatError } from '../common/utils' ;
1314import { OctokitCommon } from './common' ;
@@ -57,6 +58,7 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
5758 public updatedAt : string ;
5859 public milestone ?: IMilestone ;
5960 public readonly githubRepository : GitHubRepository ;
61+ protected readonly _telemetry : ITelemetry ;
6062 public readonly remote : Remote ;
6163 public item : TItem ;
6264 public body : string ;
@@ -67,8 +69,9 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
6769 protected _onDidChange = this . _register ( new vscode . EventEmitter < IssueChangeEvent > ( ) ) ;
6870 public onDidChange = this . _onDidChange . event ;
6971
70- constructor ( githubRepository : GitHubRepository , remote : Remote , item : TItem , skipUpdate : boolean = false ) {
72+ constructor ( telemetry : ITelemetry , githubRepository : GitHubRepository , remote : Remote , item : TItem , skipUpdate : boolean = false ) {
7173 super ( ) ;
74+ this . _telemetry = telemetry ;
7275 this . githubRepository = githubRepository ;
7376 this . remote = remote ;
7477 this . item = item ;
@@ -579,6 +582,15 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
579582
580583 try {
581584 if ( schema . ReplaceActorsForAssignable ) {
585+ const assignToCopilot = allAssignees . find ( assignee => COPILOT_ACCOUNTS [ assignee . login ] ) ;
586+ const alreadyHasCopilot = this . assignees ?. find ( assignee => COPILOT_ACCOUNTS [ assignee . login ] ) !== undefined ;
587+ if ( assignToCopilot && ! alreadyHasCopilot ) {
588+ /* __GDPR__
589+ "pr.assignCopilot" : {}
590+ */
591+ this . _telemetry . sendTelemetryEvent ( 'pr.assignCopilot' ) ;
592+ }
593+
582594 const assigneeIds = allAssignees . map ( assignee => assignee . id ) ;
583595 await mutate ( {
584596 mutation : schema . ReplaceActorsForAssignable ,
0 commit comments