Skip to content

Commit 5e74067

Browse files
authored
Rest API for creating an issue doesn't support padawan (#7060)
Fixes #7033
1 parent cc7f7d6 commit 5e74067

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/issues/issueFeatureRegistrar.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { basename } from 'path';
77
import * as vscode from 'vscode';
88
import { Remote } from '../api/api';
99
import { GitApiImpl } from '../api/api1';
10+
import { COPILOT_ACCOUNTS } from '../common/comment';
1011
import { commands } from '../common/executeCommands';
1112
import { Disposable } from '../common/lifecycle';
1213
import Logger from '../common/logger';
@@ -1264,6 +1265,9 @@ ${options?.body ?? ''}\n
12641265
folderManager = await this.chooseRepo(vscode.l10n.t('Choose where to create the issue.'));
12651266
}
12661267

1268+
const assigneesWithoutCopilot = assignees?.filter(assignee => !COPILOT_ACCOUNTS[assignee]);
1269+
const copilotAssignee = !!assignees?.find(assignee => COPILOT_ACCOUNTS[assignee]);
1270+
12671271
return vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: vscode.l10n.t('Creating issue') }, async (progress) => {
12681272
if (!folderManager) {
12691273
return false;
@@ -1287,7 +1291,7 @@ ${options?.body ?? ''}\n
12871291
repo: origin.repo,
12881292
title,
12891293
body,
1290-
assignees,
1294+
assignees: assigneesWithoutCopilot,
12911295
labels,
12921296
milestone
12931297
};
@@ -1298,6 +1302,12 @@ ${options?.body ?? ''}\n
12981302
progress.report({ message: vscode.l10n.t('Creating issue in {0}...', `${createParams.owner}/${createParams.repo}`) });
12991303
const issue = await folderManager.createIssue(createParams);
13001304
if (issue) {
1305+
if (copilotAssignee) {
1306+
const copilotUser = (await folderManager.getAssignableUsers())[issue.remote.remoteName].find(user => COPILOT_ACCOUNTS[user.login]);
1307+
if (copilotUser) {
1308+
await issue.replaceAssignees([...(issue.assignees ?? []), copilotUser]);
1309+
}
1310+
}
13011311
if (projects) {
13021312
await issue.updateProjects(projects);
13031313
}

0 commit comments

Comments
 (0)