Skip to content

Commit 24420db

Browse files
committed
Implement fallback for Copilot bot ID in issue creation script
1 parent 4ce9b88 commit 24420db

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

.github/scripts/create-issue-assigned-to-copilot.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,17 @@ export async function createIssueWithCopilot(description: string): Promise<strin
5959
(node: any) => node.login === 'copilot-swe-agent'
6060
);
6161

62-
if (!copilotBot) {
63-
console.error('copilot-swe-agent not found in suggestedActors. Is Copilot coding agent enabled for this repo?');
64-
return null;
62+
let botId: string;
63+
if (copilotBot) {
64+
botId = copilotBot.id;
65+
console.log(`Found Copilot bot: login=${copilotBot.login}, id=${botId}, type=${copilotBot.__typename}`);
66+
} else {
67+
// Fallback: the GITHUB_TOKEN in Actions may lack permission to see suggestedActors.
68+
// Use the known node ID for copilot-swe-agent.
69+
botId = 'BOT_kgDOC9w8XQ';
70+
console.log(`copilot-swe-agent not found in suggestedActors, using known bot ID: ${botId}`);
6571
}
6672

67-
console.log(`Found Copilot bot: login=${copilotBot.login}, id=${copilotBot.id}, type=${copilotBot.__typename}`);
68-
6973
const title = description.split('\n')[0].slice(0, 100);
7074

7175
// Step 2: Create issue with agentAssignment and required GraphQL-Features header
@@ -96,7 +100,7 @@ export async function createIssueWithCopilot(description: string): Promise<strin
96100
repoId,
97101
title,
98102
body: description,
99-
assigneeIds: [copilotBot.id],
103+
assigneeIds: [botId],
100104
headers: {
101105
'GraphQL-Features': GRAPHQL_FEATURES_HEADER,
102106
},

0 commit comments

Comments
 (0)