Skip to content

Fix verify-links regex to handle repository URIs with .git suffix#13560

Merged
weshaggard merged 4 commits intomainfrom
copilot/fix-verify-links-regex
Jan 14, 2026
Merged

Fix verify-links regex to handle repository URIs with .git suffix#13560
weshaggard merged 4 commits intomainfrom
copilot/fix-verify-links-regex

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

  • Understand the issue with .git suffix in source repository URIs
  • Update the BranchReplaceRegex pattern to handle optional .git suffix
  • Create tests to validate the fix
  • Run tests to verify the changes
  • Perform code review and security check
  • Refactor tests to use shared default regex variable instead of duplicating it
  • Escape backslash in YAML for proper Azure DevOps parsing
Original prompt

This section details on the original issue you should resolve

<issue_title>verify-links branch protection doesn't correctly handle source uris that end in .git'</issue_title> <issue_description>Looking at https://dev.azure.com/azure-sdk/public/_build/results?buildId=3723905&view=logs&j=3facec84-71ec-57ab-8937-e7da3fbb0ee2 I see system.pullRequest.sourceRepositoryUri : https://github.com/Azure/azure-sdk-for-java.git`

But our ⁠regex is not expecting the .git on the uri. See another ⁠PR as an example where that isn't present. Since it isn't expecting that it doesn't correctly replace the link and thus will cause new links in a PR to fail, example PR Azure/azure-sdk-for-java#39858.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: weshaggard <9010698+weshaggard@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix regex to handle source URIs ending with .git Fix verify-links regex to handle repository URIs with .git suffix Jan 13, 2026
Copilot AI requested a review from weshaggard January 13, 2026 20:51
function Test-ReplaceGithubLink {
param(
[string]$originLink,
[string]$branchReplaceRegex,
Copy link
Member

Choose a reason for hiding this comment

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

@copilot default the shared regex here instead of duplicating it in all the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in commit 92bdf41. The shared regex pattern with optional .git suffix is now defined as $defaultRegex in the BeforeAll block and reused throughout the tests.

Co-authored-by: weshaggard <9010698+weshaggard@users.noreply.github.com>
@weshaggard
Copy link
Member

/azp run azure-sdk-tools - sync - eng-common

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Co-authored-by: weshaggard <9010698+weshaggard@users.noreply.github.com>
@weshaggard
Copy link
Member

/azp run azure-sdk-tools - sync - eng-common

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

Copy link
Contributor

Copilot AI left a comment

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 fixes a bug in the verify-links pipeline where repository URIs ending with .git were not being handled correctly by the branch replacement regex pattern.

Changes:

  • Updated the BranchReplaceRegex pattern in verify-links.yml to handle optional .git suffix
  • Added comprehensive Pester tests to validate the fix for various scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
eng/common/pipelines/templates/steps/verify-links.yml Updated regex pattern to make .git suffix optional using (?:\\.git)?
eng/common-tests/Verify-Links-ReplaceGithubLink.Tests.ps1 Added comprehensive test suite covering scenarios with and without .git suffix

azure-sdk added a commit to Azure/azure-sdk-for-js that referenced this pull request Jan 14, 2026
Sync eng/common directory with azure-sdk-tools for PR
Azure/azure-sdk-tools#13560 See [eng/common
workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: weshaggard <9010698+weshaggard@users.noreply.github.com>
azure-sdk added a commit to Azure/azure-sdk-for-rust that referenced this pull request Jan 14, 2026
Sync eng/common directory with azure-sdk-tools for PR
Azure/azure-sdk-tools#13560 See [eng/common
workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: weshaggard <9010698+weshaggard@users.noreply.github.com>
@weshaggard weshaggard merged commit 73b3079 into main Jan 14, 2026
16 checks passed
@weshaggard weshaggard deleted the copilot/fix-verify-links-regex branch January 14, 2026 23:06
Copy link

@slater82 slater82 left a comment

Choose a reason for hiding this comment

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

Approved

chlowell pushed a commit to Azure/azure-sdk-for-rust that referenced this pull request Jan 16, 2026
Sync eng/common directory with azure-sdk-tools for PR
Azure/azure-sdk-tools#13560 See [eng/common
workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: weshaggard <9010698+weshaggard@users.noreply.github.com>
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.

verify-links branch protection doesn't correctly handle source uris that end in `.git'

4 participants