Skip to content

Link PRs in Forward Flows#5355

Merged
dkurepa merged 5 commits into
dotnet:mainfrom
dkurepa:dkurepa/LinkPRsInCodeflows
Oct 13, 2025
Merged

Link PRs in Forward Flows#5355
dkurepa merged 5 commits into
dotnet:mainfrom
dkurepa:dkurepa/LinkPRsInCodeflows

Conversation

@dkurepa

@dkurepa dkurepa commented Oct 9, 2025

Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings October 9, 2025 15:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +68 to +74
// 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+):");

Copilot AI Oct 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'github' to 'GitHub' in comment.

Copilot uses AI. Check for mistakes.

// 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+)\\)$");

Copilot AI Oct 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +70 to +74
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+):");

Copilot AI Oct 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
@dkurepa dkurepa requested review from adamzip and premun October 10, 2025 08:39
Comment thread src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrForwardFlower.cs Outdated
Comment thread src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrForwardFlower.cs Outdated
Comment thread src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrForwardFlower.cs Outdated
@dkurepa dkurepa merged commit cb600e3 into dotnet:main Oct 13, 2025
8 of 9 checks passed
@dkurepa

dkurepa commented Oct 29, 2025

Copy link
Copy Markdown
Member Author

https://github.com/dotnet/dnceng-shared/pull/106 test

@dkurepa

dkurepa commented Oct 29, 2025

Copy link
Copy Markdown
Member Author

dotnet/dnceng-shared#106 test2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants