Skip to content

Commit

Permalink
fix bunch issue
Browse files Browse the repository at this point in the history
  • Loading branch information
victorhuangwq committed Mar 26, 2024
1 parent afb4c9b commit b28881a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/tagPriorityLow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,26 @@ jobs:
// Querying Lastest Work Items
const queryResult = await adoClient.queryById(process.env.query_id);
// Iterate over work items, including relations
// https://github.com/microsoft/azure-devops-node-api/blob/master/api/interfaces/WorkItemTrackingInterfaces.ts#L1485
const workItemsDetails = await adoClient.getWorkItems(queryResult.workItems.map(wi => wi.id), null, null, 1);
// Work Item IDs
const workItemIds = queryResult.workItems.map(wi => wi.id);
// getWorkItems has a limit of 200, so we need to batch the requests
const batchSize = 200;
const workItemsDetails = [];
for (let i = 0; i < workItemIds.length; i += batchSize) {
const batchIds = workItemIds.slice(i, i + batchSize);
// Include relations in the response
// https://github.com/microsoft/azure-devops-node-api/blob/master/api/interfaces/WorkItemTrackingInterfaces.ts#L1485
const batchDetails = await adoClient.getWorkItems(batchIds, null, null, 1);
workItemsDetails.push(...batchDetails);
}
// Obtain GitHub Issue Number
function getGitHubIssueNumber(workItem) {
console.log(workItem);
// Try using relations
const relation = workItem.relations.find(r => r.rel === 'Hyperlink' && r.url.includes('github.com'));
if (relation) {
Expand Down

0 comments on commit b28881a

Please sign in to comment.