@@ -336,6 +336,7 @@ private async Task RetrieveLabelIdsAsync(string org, string repo)
336
336
int parentId = parentIdFromIssue ( ghIssue ) ;
337
337
string ? ghAssigneeEmailAddress = await ghIssue . QueryAssignedMicrosoftEmailAddressAsync ( _ospoClient ) ;
338
338
AzDoIdentity ? questAssigneeID = default ;
339
+ var proposedQuestState = questItem . State ;
339
340
if ( ghAssigneeEmailAddress ? . EndsWith ( "@microsoft.com" ) == true )
340
341
{
341
342
questAssigneeID = await _azdoClient . GetIDFromEmail ( ghAssigneeEmailAddress ) ;
@@ -385,13 +386,7 @@ private async Task RetrieveLabelIdsAsync(string org, string repo)
385
386
bool questItemOpen = questItem . State is not "Closed" ;
386
387
if ( ghIssue . IsOpen != questItemOpen )
387
388
{
388
- // build patch document for state.
389
- patchDocument . Add ( new JsonPatchDocument
390
- {
391
- Operation = Op . Add ,
392
- Path = "/fields/System.State" ,
393
- Value = ghIssue . IsOpen ? "Active" : "Closed" ,
394
- } ) ;
389
+ proposedQuestState = ghIssue . IsOpen ? "Committed" : "Closed" ;
395
390
396
391
// When the issue is opened or closed,
397
392
// update the description. That picks up any new
@@ -413,12 +408,22 @@ private async Task RetrieveLabelIdsAsync(string org, string repo)
413
408
{
414
409
Console . WriteLine ( $ "Moving to the backlog / future iteration.") ;
415
410
iteration = QuestIteration . FutureIteration ( allIterations ) ;
411
+ proposedQuestState = "New" ;
416
412
}
417
413
}
418
414
else
419
415
{
420
416
Console . WriteLine ( "No GitHub sprint project found - using current iteration." ) ;
421
417
}
418
+ if ( proposedQuestState != questItem . State )
419
+ {
420
+ patchDocument . Add ( new JsonPatchDocument
421
+ {
422
+ Operation = Op . Add ,
423
+ Path = "/fields/System.State" ,
424
+ Value = proposedQuestState ,
425
+ } ) ;
426
+ }
422
427
if ( ( iteration is not null ) && ( iteration . Path != questItem . IterationPath ) )
423
428
{
424
429
patchDocument . Add ( new JsonPatchDocument
0 commit comments