Skip to content

Commit 0170955

Browse files
committed
Push backlog issues by type
1 parent bd7cd20 commit 0170955

2 files changed

Lines changed: 60 additions & 1 deletion

File tree

GithubIssueTagger/GithubIssueTagger.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
2222
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
2323
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
24-
<PackageReference Include="Octokit" Version="9.0.0" />
24+
<PackageReference Include="Octokit" Version="13.0.1" />
2525
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
2626
</ItemGroup>
2727

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using Newtonsoft.Json;
2+
using Octokit;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using System.Linq;
7+
using System.Threading.Tasks;
8+
9+
namespace GithubIssueTagger.Reports
10+
{
11+
internal class BacklogIssuesByType : IReport
12+
{
13+
private GitHubClient _client;
14+
private QueryCache _queryCache;
15+
16+
public BacklogIssuesByType(GitHubClient client, QueryCache queryCache)
17+
{
18+
_client = client ?? throw new ArgumentNullException(nameof(client));
19+
_queryCache = queryCache ?? throw new ArgumentNullException(nameof(queryCache));
20+
}
21+
22+
public async Task RunAsync()
23+
{
24+
var issues = await IssueUtilities.GetIssuesForAnyMatchingLabelsAsync(_client, "nuget", "home", "Priority:1", "Priority:2");
25+
var outputFileName = "home.issues";
26+
var json = JsonConvert.SerializeObject(issues, Formatting.Indented);
27+
File.WriteAllText(outputFileName, json);
28+
29+
Dictionary<string, int> keyValuePairs = new Dictionary<string, int>()
30+
{
31+
{ "Type:Bug", 0 },
32+
{ "Type:DCR", 0 },
33+
{ "Type:Feature", 0 },
34+
{ "Type:Test", 0 },
35+
{ "Type:Engineering", 0 },
36+
{ "Type:Tracking", 0 },
37+
{ "Type:DataAnalysis", 0 },
38+
{ "Type:Docs", 0 },
39+
{ "Type:DeveloperDocs", 0 },
40+
{ "Type:Spec", 0 },
41+
};
42+
43+
foreach (var issue in issues)
44+
{
45+
foreach (var label in issue.Labels)
46+
{
47+
if (keyValuePairs.ContainsKey(label.Name))
48+
{
49+
keyValuePairs[label.Name] += 1;
50+
}
51+
}
52+
}
53+
foreach (var kvp in keyValuePairs)
54+
{
55+
Console.WriteLine($"{kvp.Key} : {kvp.Value}");
56+
}
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)