Skip to content

Commit b11af10

Browse files
committed
get GitHub ids
1 parent 82d4436 commit b11af10

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/update-low-priority.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,20 @@ jobs:
3737
// Iterate over work items
3838
const workItemsDetails = await adoClient.getWorkItems(queryResult.workItems.map(wi => wi.id), null, null, 1);
3939
40-
for (relations of workItemsDetails[0]){
41-
print(relations.attributes);
40+
// Obtain GitHub Issue Number
41+
function getGitHubIssueNumber(workItem) {
42+
const relation = workItem.relations.find(r => r.rel === 'Hyperlink' && r.url.includes('github.com'));
43+
if (relation) {
44+
const match = relation.url.match(/github.com\/[^/]+\/[^/]+\/issues\/(\d+)/);
45+
if (match) {
46+
return match[1];
47+
}
48+
}
49+
return null;
4250
}
43-
51+
52+
// Map ADO work items to GitHub number
53+
const ghIssueNumbers = workItemsDetails.map(wi => getGitHubIssueNumber(wi));
54+
console.log(ghIssueNumbers);
55+
4456

0 commit comments

Comments
 (0)