Skip to content

Commit 69c9e91

Browse files
authored
Update the GH squash commit RegEx to remove the PR number. (#1483)
Noticed that we were not removing PR numbers when [fixing up the C# ext. CHANGELOG](dotnet/vscode-csharp#8071). Leaving the PR number in allows GH to turn it into a link when the number is in the range to be valid. BEFORE: * React to NuGet package pruning warnings (#11496) (PR: [#11496](dotnet/razor#11496)) * Add a couple of "stress tests" to the integration test project (#11481) (PR: [#11481](dotnet/razor#11481)) * Fix a couple of options in the old options screen (#11486) (PR: [#11486](dotnet/razor#11486)) * Don't use Directory.Exists to check if a path is relative (#11483) (PR: [#11483](dotnet/razor#11483)) * Fix another IDE0040 violation (#11474) (PR: [#11474](dotnet/razor#11474)) * Remove accessibility modifiers from interface members (#11472) (PR: [#11472](dotnet/razor#11472)) AFTER: * React to NuGet package pruning warnings (PR: [#11496](dotnet/razor#11496)) * Add a couple of "stress tests" to the integration test project (PR: [#11481](dotnet/razor#11481)) * Fix a couple of options in the old options screen (PR: [#11486](dotnet/razor#11486)) * Don't use Directory.Exists to check if a path is relative (PR: [#11483](dotnet/razor#11483)) * Fix another IDE0040 violation (PR: [#11474](dotnet/razor#11474)) * Remove accessibility modifiers from interface members (PR: [#11472](dotnet/razor#11472))
2 parents 6113a43 + 8b1d805 commit 69c9e91

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/dotnet-roslyn-tools/.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@
2222
"console": "internalConsole",
2323
"stopAtEntry": false
2424
},
25+
{
26+
"name": "Run `pr-finder` on Razor",
27+
"type": "coreclr",
28+
"request": "launch",
29+
"preLaunchTask": "build",
30+
"program": "${workspaceFolder}/../../artifacts/bin/Microsoft.RoslynTools/Debug/net9.0/Microsoft.RoslynTools.dll",
31+
"args": [
32+
"pr-finder",
33+
"-s",
34+
"e15fe5b8b38c1b1e1adb9c8a4d76567aa1c397db",
35+
"-e",
36+
"main",
37+
"--format",
38+
"changelog",
39+
"-v",
40+
"diag"
41+
],
42+
"cwd": "${workspaceFolder}/../../../razor",
43+
"console": "internalConsole",
44+
"stopAtEntry": false
45+
},
2546
{
2647
"name": "Run `vsbranchinfo`",
2748
"type": "coreclr",

src/dotnet-roslyn-tools/PRFinder/Hosts/GitHub.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ public bool ShouldSkip(Commit commit, ref bool mergePRFound)
9393
match = IsGitHubSquashedPRCommit().Match(commit.MessageShort);
9494
if (match.Success)
9595
{
96-
var prNumber = match.Groups[1].Value;
96+
var prNumber = match.Groups[2].Value;
9797

9898
// Squash PR Messages are in the form "Nullable annotate TypeCompilationState and MessageID (#39449)"
99-
// Take the 1st line since it should be descriptive.
100-
var comment = commit.MessageShort;
99+
// Take the first line up until the PR number.
100+
var comment = match.Groups[1].Value;
101101
return new(prNumber, comment);
102102
}
103103
}
@@ -198,6 +198,6 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
198198
private static partial Regex IsGitHubActionCodeFlowCommit();
199199
[GeneratedRegex(@"^Merge pull request #(\d+) from")]
200200
private static partial Regex IsGitHubMergePRCommit();
201-
[GeneratedRegex(@"\(#(\d+)\)(?:\n|$)")]
201+
[GeneratedRegex(@"^(.*) \(#(\d+)\)(?:\n|$)")]
202202
private static partial Regex IsGitHubSquashedPRCommit();
203203
}

0 commit comments

Comments
 (0)