Link PRs in Forward Flows#5355
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements functionality to link pull requests in forward flow operations within the Product Construction Service. The change enables the system to extract PR numbers from commit messages and add comments with PR links to forward flow operations.
- Adds PR number extraction logic for both GitHub and Azure DevOps repositories using regex patterns
- Updates forward flow process to comment included PRs when meaningful changes are detected
- Modifies scenario tests to verify PR linking functionality works correctly
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrForwardFlower.cs |
Implements core PR linking functionality with regex extraction and comment generation |
test/ProductConstructionService.ScenarioTests/ScenarioTests/ScenarioTests_CodeFlow.cs |
Adds test validation for PR linking in forward flow scenarios |
test/ProductConstructionService.ScenarioTests/CodeFlowScenarioTestBase.cs |
Updates test infrastructure to support PR comment verification |
test/Microsoft.DotNet.DarcLib.Codeflow.Tests/ForwardFlowTests.cs |
Removes trailing whitespace |
| // Regex to extract PR number from a github merge commit message | ||
| // e.g.: "Update dependencies from source-repo (#12345)" extracts "12345" | ||
| private readonly static Regex GitHubPullRequestNumberExtractionRegex = new Regex(".+\\(#(\\d+)\\)$"); | ||
|
|
||
| // Regex to extract PR number from an AzDO merge commit message | ||
| // e.g.: "Merged PR 12345: Update dependencies from source-repo" extracts "12345" | ||
| private readonly static Regex AzDoPullRequestNumberExtractionRegex = new Regex("^Merged PR (\\d+):"); |
There was a problem hiding this comment.
Corrected spelling of 'github' to 'GitHub' in comment.
|
|
||
| // Regex to extract PR number from a github merge commit message | ||
| // e.g.: "Update dependencies from source-repo (#12345)" extracts "12345" | ||
| private readonly static Regex GitHubPullRequestNumberExtractionRegex = new Regex(".+\\(#(\\d+)\\)$"); |
There was a problem hiding this comment.
Consider using RegexOptions.Compiled for these static regex patterns to improve performance, or use the newer source generator approach with [GeneratedRegex] attribute for better performance and compile-time validation.
| private readonly static Regex GitHubPullRequestNumberExtractionRegex = new Regex(".+\\(#(\\d+)\\)$"); | ||
|
|
||
| // Regex to extract PR number from an AzDO merge commit message | ||
| // e.g.: "Merged PR 12345: Update dependencies from source-repo" extracts "12345" | ||
| private readonly static Regex AzDoPullRequestNumberExtractionRegex = new Regex("^Merged PR (\\d+):"); |
There was a problem hiding this comment.
Consider using RegexOptions.Compiled for these static regex patterns to improve performance, or use the newer source generator approach with [GeneratedRegex] attribute for better performance and compile-time validation.
| private readonly static Regex GitHubPullRequestNumberExtractionRegex = new Regex(".+\\(#(\\d+)\\)$"); | |
| // Regex to extract PR number from an AzDO merge commit message | |
| // e.g.: "Merged PR 12345: Update dependencies from source-repo" extracts "12345" | |
| private readonly static Regex AzDoPullRequestNumberExtractionRegex = new Regex("^Merged PR (\\d+):"); | |
| private readonly static Regex GitHubPullRequestNumberExtractionRegex = new Regex(".+\\(#(\\d+)\\)$", RegexOptions.Compiled); | |
| // Regex to extract PR number from an AzDO merge commit message | |
| // e.g.: "Merged PR 12345: Update dependencies from source-repo" extracts "12345" | |
| private readonly static Regex AzDoPullRequestNumberExtractionRegex = new Regex("^Merged PR (\\d+):", RegexOptions.Compiled); |
|
|
|
dotnet/dnceng-shared#106 test2 |
#5263