Skip to content

Commit aaebbb3

Browse files
authored
A couple small bug fixes (#381)
1. Issues without a priority caused a crash. 2. A project name that didn't match the correct format caused a crash.
1 parent 5e8bcc7 commit aaebbb3

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

DotNet.DocsTools/GitHubObjects/StoryPointSize.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,15 @@ public static bool TryGetMonthOrdinal(string month, out int ordinal)
6767
projectTitle.Contains("sprint", StringComparison.CurrentCultureIgnoreCase))
6868
{
6969
string[] components = projectTitle.Split(' ');
70-
int yearIndex = (sprintMonth is null) ? 2 : 1;
71-
// Should be in a project variable named "Sprint", take substring 0,3
72-
string month = sprintMonth ?? components[1];
73-
if (int.TryParse(components[yearIndex], out int year))
70+
if (components.Length > 2)
7471
{
75-
sz = new StoryPointSize(year, month.Substring(0, 3), size, priority);
72+
int yearIndex = (sprintMonth is null) ? 2 : 1;
73+
// Should be in a project variable named "Sprint", take substring 0,3
74+
string month = sprintMonth ?? components[1];
75+
if (int.TryParse(components[yearIndex], out int year))
76+
{
77+
sz = new StoryPointSize(year, month.Substring(0, 3), size, priority);
78+
}
7679
}
7780
}
7881
} else

actions/sequester/ImportIssues/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ await serviceWorker.ProcessIssues(
7878
Console.Error.WriteLine($"!!!ERROR!!! Could not communicate with Quest Azure DevOps server. Did your PAT expire?");
7979
Console.Error.WriteLine($":: -- {e.Message} -- ");
8080
Console.Error.WriteLine(e.ToString());
81+
return 1;
8182
}
8283
catch (Exception ex)
8384
{

actions/sequester/Quest2GitHub/Models/QuestWorkItem.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,17 @@ public static async Task<QuestWorkItem> CreateWorkItemAsync(QuestIssueOrPullRequ
238238
Value = iterationSize.QuestStoryPoint(),
239239
});
240240
}
241-
patchDocument.Add(new JsonPatchDocument
241+
int? priority = issue.GetPriority(iterationSize);
242+
if (priority.HasValue)
242243
{
243-
Operation = Op.Add,
244-
From = default,
245-
Path = "/fields/Microsoft.VSTS.Common.Priority",
246-
Value = issue.GetPriority(iterationSize)
247-
});
244+
patchDocument.Add(new JsonPatchDocument
245+
{
246+
Operation = Op.Add,
247+
From = default,
248+
Path = "/fields/Microsoft.VSTS.Common.Priority",
249+
Value = priority
250+
});
251+
}
248252

249253
var tags = issue.WorkItemTagsForIssue(tagMap);
250254
if (tags.Any())

0 commit comments

Comments
 (0)