Skip to content

Commit 27fb841

Browse files
BillWagneradegeo
andauthored
Tag workitems assigned to Copilot (#522)
* Tag workitems assigned to Copilot As we experiment with assigning some issues to Copilot, we want to track that activity. This tags any imported issue where one of the assignees is "Copilot". * Update actions/sequester/Quest2GitHub/Options/ImportOptions.cs Co-authored-by: Andy (Steve) De George <[email protected]> --------- Co-authored-by: Andy (Steve) De George <[email protected]>
1 parent e737250 commit 27fb841

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

actions/sequester/ImportIssues/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ private static async Task<QuestGitHubService> CreateService(ImportOptions option
120120
options.UnlinkLabel,
121121
options.ParentNodes,
122122
options.WorkItemTags,
123-
options.TeamGitHubLogins);
123+
options.TeamGitHubLogins,
124+
options.CopilotIssueTag);
124125
}
125126
}

actions/sequester/Quest2GitHub.Tests/BuildExtendedPropertiesTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ private static WorkItemProperties CreateIssueObject(string jsonDocument)
738738
issueNumber = 1111
739739
};
740740
JsonElement element = JsonDocument.Parse(jsonDocument).RootElement;
741-
return new WorkItemProperties(QuestIssue.FromJsonElement(element, variables), _allIterations, _tagMap, _parentMap);
741+
return new WorkItemProperties(QuestIssue.FromJsonElement(element, variables), _allIterations, _tagMap, _parentMap, "copilotTag");
742742
}
743743

744744
}

actions/sequester/Quest2GitHub/Models/WorkItemProperties.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public class WorkItemProperties
2121
public WorkItemProperties (QuestIssueOrPullRequest issue,
2222
IEnumerable<QuestIteration> iterations,
2323
IEnumerable<LabelToTagMap> tags,
24-
IEnumerable<ParentForLabel> parentNodes)
24+
IEnumerable<ParentForLabel> parentNodes,
25+
string copilotTag)
2526
{
2627
StoryPointSize? storySize = LatestStoryPointSize(issue);
2728
StoryPoints = QuestStoryPoint(storySize) ?? 0;
@@ -57,7 +58,7 @@ public WorkItemProperties (QuestIssueOrPullRequest issue,
5758
}
5859
}
5960

60-
Tags = WorkItemTagsForIssue(issue, tags);
61+
Tags = WorkItemTagsForIssue(issue, tags, copilotTag);
6162

6263
string month = storySize?.Month ?? "Unknown";
6364
int calendarYear = storySize?.CalendarYear ?? 0;
@@ -163,7 +164,7 @@ month descending
163164
return default;
164165
}
165166

166-
private static IEnumerable<string> WorkItemTagsForIssue(QuestIssueOrPullRequest issue, IEnumerable<LabelToTagMap> tags)
167+
private static IEnumerable<string> WorkItemTagsForIssue(QuestIssueOrPullRequest issue, IEnumerable<LabelToTagMap> tags, string copilotTag)
167168
{
168169
foreach (var label in issue.Labels)
169170
{
@@ -173,5 +174,10 @@ private static IEnumerable<string> WorkItemTagsForIssue(QuestIssueOrPullRequest
173174
yield return tag.Tag;
174175
}
175176
}
177+
// Add custom tag if one of the assignees is "Copilot":
178+
if (issue.Assignees.Any(a => (a.Login == "Copilot") && (string.IsNullOrWhiteSpace(a.Name))))
179+
{
180+
yield return copilotTag;
181+
}
176182
}
177183
}

actions/sequester/Quest2GitHub/Options/ImportOptions.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,21 @@ public sealed record class ImportOptions
9696
/// </remarks>
9797
public List<string> TeamGitHubLogins { get; init; } =
9898
[
99-
"CamSoper",
10099
"BillWagner",
101100
"tdykstra",
102101
"IEvangelist",
103-
"davidbritch",
104102
"gewarren",
105103
"cmastr",
106104
"adegeo",
107-
"Rick-Anderson",
108105
"wadepickett"
109106
];
107+
108+
/// <summary>
109+
/// This tag is added to issues that are assigned to Copilot.
110+
/// </summary>
111+
/// <remarks>
112+
/// The human assignee is assigned to review and prompt Copilot to perform
113+
/// the toil of the work.
114+
/// </remarks>
115+
public string CopilotIssueTag { get; init; } = "Assignee-Copilot";
110116
}

actions/sequester/Quest2GitHub/QuestGitHubService.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ public class QuestGitHubService(
4141
string removeLinkItemText,
4242
List<ParentForLabel> parentNodes,
4343
IEnumerable<LabelToTagMap> tagMap,
44-
IEnumerable<string> gitHubLogins) : IDisposable
44+
IEnumerable<string> gitHubLogins,
45+
string copilotTag) : IDisposable
4546
{
4647
private const string LinkedWorkItemComment = "Associated WorkItem - ";
4748
private readonly QuestClient _azdoClient = new(azdoKey, questOrg, questProject);
@@ -96,7 +97,7 @@ async Task ProcessItems(IAsyncEnumerable<QuestIssueOrPullRequest> items)
9697
QuestWorkItem? questItem = (request || sequestered || vanquished)
9798
? await FindLinkedWorkItemAsync(item)
9899
: null;
99-
var issueProperties = new WorkItemProperties(item, _allIterations, tagMap, parentNodes);
100+
var issueProperties = new WorkItemProperties(item, _allIterations, tagMap, parentNodes, copilotTag);
100101

101102
Console.WriteLine($"{item.Number}: {item.Title}, {issueProperties.IssueLogString}");
102103
Task workDone = (request, sequestered, vanquished, questItem) switch
@@ -183,7 +184,7 @@ public async Task ProcessIssue(string gitHubOrganization, string gitHubRepositor
183184
? await FindLinkedWorkItemAsync(ghIssue)
184185
: null;
185186

186-
var issueProperties = new WorkItemProperties(ghIssue, _allIterations, tagMap, parentNodes);
187+
var issueProperties = new WorkItemProperties(ghIssue, _allIterations, tagMap, parentNodes, copilotTag);
187188

188189
Task workDone = (request, sequestered, vanquished, questItem) switch
189190
{

0 commit comments

Comments
 (0)