@@ -37,7 +37,8 @@ public class QuestGitHubService(
37
37
string importTriggerLabelText ,
38
38
string importedLabelText ,
39
39
int defaultParentNode ,
40
- List < ParentForLabel > parentNodes ) : IDisposable
40
+ List < ParentForLabel > parentNodes ,
41
+ IEnumerable < LabelToTagMap > tagMap ) : IDisposable
41
42
{
42
43
private const string LinkedWorkItemComment = "Associated WorkItem - " ;
43
44
private readonly QuestClient _azdoClient = new ( azdoKey , questOrg , questProject ) ;
@@ -95,7 +96,7 @@ async Task ProcessItems(IAsyncEnumerable<QuestIssueOrPullRequest> items)
95
96
{
96
97
if ( questItem != null )
97
98
{
98
- await UpdateWorkItemAsync ( questItem , item , _allIterations ) ;
99
+ await UpdateWorkItemAsync ( questItem , item , _allIterations , tagMap ) ;
99
100
}
100
101
else
101
102
{
@@ -183,7 +184,7 @@ public async Task ProcessIssue(string gitHubOrganization, string gitHubRepositor
183
184
{
184
185
// This allows a human to force a manual update: just add the trigger label.
185
186
// Note that it updates even if the item is closed.
186
- await UpdateWorkItemAsync ( questItem , ghIssue , _allIterations ) ;
187
+ await UpdateWorkItemAsync ( questItem , ghIssue , _allIterations , tagMap ) ;
187
188
188
189
}
189
190
// Next, if the item is already linked, consider any updates.
@@ -194,7 +195,7 @@ public async Task ProcessIssue(string gitHubOrganization, string gitHubRepositor
194
195
}
195
196
else if ( sequestered && questItem is not null )
196
197
{
197
- await UpdateWorkItemAsync ( questItem , ghIssue , _allIterations ) ;
198
+ await UpdateWorkItemAsync ( questItem , ghIssue , _allIterations , tagMap ) ;
198
199
}
199
200
}
200
201
@@ -244,15 +245,15 @@ private async Task<QuestIteration[]> RetrieveIterationLabelsAsync()
244
245
return [ .. iterations ] ;
245
246
}
246
247
247
-
248
248
private async Task < QuestWorkItem ? > LinkIssueAsync ( QuestIssueOrPullRequest issueOrPullRequest , QuestIteration currentIteration , IEnumerable < QuestIteration > allIterations )
249
249
{
250
250
int ? workItem = LinkedQuestId ( issueOrPullRequest ) ;
251
251
int parentId = parentIdFromIssue ( issueOrPullRequest ) ;
252
252
if ( workItem is null )
253
253
{
254
254
// Create work item:
255
- QuestWorkItem questItem = await QuestWorkItem . CreateWorkItemAsync ( issueOrPullRequest , parentId , _azdoClient , _ospoClient , areaPath , _importTriggerLabel ? . Id , currentIteration , allIterations ) ;
255
+ QuestWorkItem questItem = await QuestWorkItem . CreateWorkItemAsync ( issueOrPullRequest , parentId , _azdoClient , _ospoClient , areaPath ,
256
+ _importTriggerLabel ? . Id , currentIteration , allIterations , tagMap ) ;
256
257
257
258
string linkText = $ "[{ LinkedWorkItemComment } { questItem . Id } ]({ _questLinkString } { questItem . Id } )";
258
259
string updatedBody = $ """
@@ -291,7 +292,10 @@ private async Task RetrieveLabelIdsAsync(string org, string repo)
291
292
}
292
293
}
293
294
294
- private async Task < QuestWorkItem ? > UpdateWorkItemAsync ( QuestWorkItem questItem , QuestIssueOrPullRequest ghIssue , IEnumerable < QuestIteration > allIterations )
295
+ private async Task < QuestWorkItem ? > UpdateWorkItemAsync ( QuestWorkItem questItem ,
296
+ QuestIssueOrPullRequest ghIssue ,
297
+ IEnumerable < QuestIteration > allIterations ,
298
+ IEnumerable < LabelToTagMap > tagMap )
295
299
{
296
300
int parentId = parentIdFromIssue ( ghIssue ) ;
297
301
string ? ghAssigneeEmailAddress = await ghIssue . QueryAssignedMicrosoftEmailAddressAsync ( _ospoClient ) ;
@@ -392,6 +396,20 @@ private async Task RetrieveLabelIdsAsync(string org, string repo)
392
396
Value = iterationSize . QuestStoryPoint ( ) ,
393
397
} ) ;
394
398
}
399
+ var tags = from t in ghIssue . WorkItemTagsForIssue ( tagMap )
400
+ where ! questItem . Tags . Contains ( t )
401
+ select t ;
402
+ if ( tags . Any ( ) )
403
+ {
404
+ string azDoTags = string . Join ( ";" , tags ) ;
405
+ patchDocument . Add ( new JsonPatchDocument
406
+ {
407
+ Operation = Op . Add ,
408
+ Path = "/fields/System.Tags" ,
409
+ Value = azDoTags
410
+ } ) ;
411
+ }
412
+
395
413
QuestWorkItem ? newItem = default ;
396
414
if ( patchDocument . Count != 0 )
397
415
{
0 commit comments