Validate GitHub links against local filesystem to catch PR-induced broken links #1500
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Verify-Links.ps1only checked links against remote state, missing cases where PRs delete referenced files or create files for non-Azure orgs.Changes
Verify-Links.ps1:localBuildTargetBranchparameter to receive PR target branch from$env:SYSTEM_PULLREQUEST_TARGETBRANCHmicrosoft,Azure, etc.)raw.githubusercontent.comURLs alongsidegithub.com/blob|treeformatcurrentRepo+targetBranch:[^#?]*instead of.*in regex (ReDoS prevention), log relative paths onlyverify-links.yml:-localBuildTargetBranch "$env:SYSTEM_PULLREQUEST_TARGETBRANCH"to scriptExample
Impact:
docs/guide.mdwith link to it now fails validationdocs/new.mdwith link to it now passes validationWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.ms/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)azure.github.io/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)cla.opensource.microsoft.com/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)go.microsoft.com/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)insiders.vscode.dev/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)learn.microsoft.com/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)marketplace.eclipse.org/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)marketplace.visualstudio.com/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)modelcontextprotocol.io/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)opensource.microsoft.com/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)plugins.jetbrains.com/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)spec.modelcontextprotocol.io/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)vscode.dev/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)www.nuget.org/usr/bin/pwsh pwsh /tmp/test_real_repo.ps1(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-String -Pattern 'Checked|broken'(dns block)/usr/bin/pwsh pwsh -c & ./eng/common/scripts/Verify-Links.ps1 -urls ./README.md -localBuildRepoName 'microsoft/mcp' -localBuildRepoPath . -localBuildTargetBranch 'main' -recursive $false 2>&1 | Select-Object -Last 5(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.