Skip to content

Commit dac41c5

Browse files
authored
chore: migrate away from deprecated jira API (#2001)
2 parents 219ca0f + bb57eaa commit dac41c5

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

automation/utils/src/jira.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface JiraProject {
1414
}
1515

1616
interface JiraIssue {
17+
id: string;
1718
key: string;
1819
fields: {
1920
summary: string;
@@ -66,7 +67,7 @@ export class Jira {
6667
}
6768

6869
if (!response.ok) {
69-
throw new Error(`API request failed (${response.status}): ${response.statusText}`);
70+
throw new Error(`API request failed (${response.status}): ${response.statusText}. While fetching: ${url}`);
7071
}
7172

7273
if (response.status === 204) {
@@ -154,19 +155,14 @@ export class Jira {
154155
});
155156
}
156157

157-
private async getIssuesForVersion(versionId: string): Promise<string[]> {
158-
const issues = await this.apiRequest<{ issues: Array<{ key: string }> }>(
159-
"GET",
160-
`/search?jql=fixVersion=${versionId}`
161-
);
162-
163-
return issues.issues.map(issue => issue.key);
164-
}
165-
166158
async getIssuesWithDetailsForVersion(versionId: string): Promise<JiraIssue[]> {
167159
const response = await this.apiRequest<{ issues: JiraIssue[] }>(
168160
"GET",
169-
`/search?jql=fixVersion=${versionId}&fields=summary`
161+
`/search/jql?` +
162+
new URLSearchParams([
163+
["jql", `project = ${this.projectId} AND fixVersion = ${versionId}`],
164+
["fields", "summary"]
165+
]).toString()
170166
);
171167

172168
return response.issues;

0 commit comments

Comments
 (0)