Skip to content

Commit 95f3c1d

Browse files
committed
fix: Typo in GraphQL query variable name
1 parent 9c131d9 commit 95f3c1d

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed
Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
import type { Octokit } from '@octokit/core';
2-
import { Issue } from './Issue.js';
1+
import type { Octokit } from "@octokit/core";
2+
import { Issue } from "./Issue.js";
33

44
// https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/assign-copilot-to-an-issue#assigning-an-existing-issue
5-
export async function assignIssue(octokit: Octokit, { owner, repository, issueNumber, nodeId }: Issue) {
5+
export async function assignIssue(
6+
octokit: Octokit,
7+
{ owner, repository, issueNumber, nodeId }: Issue
8+
) {
69
// Check whether issues can be assigned to Copilot
710
const suggestedActorsResponse = await octokit.graphql<{
811
repository: {
912
suggestedActors: {
10-
nodes: { login: string, id: string }[]
11-
}
12-
}
13+
nodes: { login: string; id: string }[];
14+
};
15+
};
1316
}>(
1417
`query ($owner: String!, $repository: String!) {
1518
repository(owner: $owner, name: $repository) {
@@ -23,19 +26,24 @@ export async function assignIssue(octokit: Octokit, { owner, repository, issueNu
2326
}
2427
}
2528
}`,
26-
{ owner, repository },
29+
{ owner, repository }
2730
);
28-
if (suggestedActorsResponse?.repository?.suggestedActors?.nodes[0]?.login !== "copilot-swe-agent") {
31+
if (
32+
suggestedActorsResponse?.repository?.suggestedActors?.nodes[0]?.login !==
33+
"copilot-swe-agent"
34+
) {
2935
return;
3036
}
3137
// Get GraphQL identifier for issue (unless already provided)
3238
let issueId = nodeId;
3339
if (!issueId) {
34-
console.debug(`Fetching identifier for issue ${owner}/${repository}#${issueNumber}`);
40+
console.debug(
41+
`Fetching identifier for issue ${owner}/${repository}#${issueNumber}`
42+
);
3543
const issueResponse = await octokit.graphql<{
3644
repository: {
37-
issue: { id: string }
38-
}
45+
issue: { id: string };
46+
};
3947
}>(
4048
`query($owner: String!, $repository: String!, $issueNumber: Int!) {
4149
repository(owner: $owner, name: $repository) {
@@ -45,33 +53,37 @@ export async function assignIssue(octokit: Octokit, { owner, repository, issueNu
4553
{ owner, repository, issueNumber }
4654
);
4755
issueId = issueResponse?.repository?.issue?.id;
48-
console.debug(`Fetched identifier for issue ${owner}/${repository}#${issueNumber}: ${issueId}`);
56+
console.debug(
57+
`Fetched identifier for issue ${owner}/${repository}#${issueNumber}: ${issueId}`
58+
);
4959
} else {
50-
console.debug(`Using provided identifier for issue ${owner}/${repository}#${issueNumber}: ${issueId}`);
60+
console.debug(
61+
`Using provided identifier for issue ${owner}/${repository}#${issueNumber}: ${issueId}`
62+
);
5163
}
5264
if (!issueId) {
53-
console.warn(`Couldn’t get identifier for issue ${owner}/${repository}#${issueNumber}. Skipping assignment to Copilot.`);
65+
console.warn(
66+
`Couldn’t get identifier for issue ${owner}/${repository}#${issueNumber}. Skipping assignment to Copilot.`
67+
);
5468
return;
5569
}
5670
// Assign issue to Copilot
5771
await octokit.graphql<{
5872
replaceActorsForAssignable: {
5973
assignable: {
6074
id: string;
61-
url: string;
6275
title: string;
6376
assignees: {
64-
nodes: { login: string }[]
65-
}
66-
}
67-
}
77+
nodes: { login: string }[];
78+
};
79+
};
80+
};
6881
}>(
6982
`mutation($issueId: ID!, $assigneeId: ID!) {
7083
replaceActorsForAssignable(input: {assignableId: $issueId, actorIds: [$assigneeId]}) {
7184
assignable {
7285
... on Issue {
7386
id
74-
url
7587
title
7688
assignees(first: 10) {
7789
nodes {
@@ -82,6 +94,10 @@ export async function assignIssue(octokit: Octokit, { owner, repository, issueNu
8294
}
8395
}
8496
}`,
85-
{ issueId, assigneeId: suggestedActorsResponse?.repository?.suggestedActors?.nodes[0]?.id }
97+
{
98+
issueId,
99+
assigneeId:
100+
suggestedActorsResponse?.repository?.suggestedActors?.nodes[0]?.id,
101+
}
86102
);
87-
}
103+
}

.github/actions/fix/src/getLinkedPR.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Issue } from "./Issue.js";
33

44
export async function getLinkedPR(
55
octokit: Octokit,
6-
{ owner, repository, issueNumber, nodeId }: Issue
6+
{ owner, repository, issueNumber }: Issue
77
) {
88
// Check whether issues can be assigned to Copilot
99
const response = await octokit.graphql<{
@@ -18,8 +18,8 @@ export async function getLinkedPR(
1818
};
1919
};
2020
}>(
21-
`query($owner: String!, $repo: String!, $issueNumber: Int!) {
22-
repository(owner: $owner, name: $repo) {
21+
`query($owner: String!, $repository: String!, $issueNumber: Int!) {
22+
repository(owner: $owner, name: $repository) {
2323
issue(number: $issueNumber) {
2424
timelineItems(first: 100, itemTypes: [CONNECTED_EVENT, CROSS_REFERENCED_EVENT]) {
2525
nodes {

0 commit comments

Comments
 (0)