Adjust link checking for copilot instructions (#6824)
Disable link checking guidelines for copilot instruction files. Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
This commit is contained in:
parent
d5b73b7f6b
commit
0d4b7db2ad
@ -530,6 +530,8 @@ foreach ($url in $urls) {
|
||||
|
||||
LogGroupStart "Link checking details"
|
||||
|
||||
$originalcheckLinkGuidance = $checkLinkGuidance
|
||||
|
||||
while ($pageUrisToCheck.Count -ne 0)
|
||||
{
|
||||
$pageUri = $pageUrisToCheck.Dequeue();
|
||||
@ -538,6 +540,11 @@ while ($pageUrisToCheck.Count -ne 0)
|
||||
if ($checkedPages.ContainsKey($pageUri)) { continue }
|
||||
$checkedPages[$pageUri] = $true;
|
||||
|
||||
# copilot instructions require the use of relative links which is against our general guidance
|
||||
# but we mainly care about those guidelines for docs publishing and not copilot instructions
|
||||
# so we can disable the guidelines while validating copilot instruction files.
|
||||
if ($pageUri -match "instructions.md$") { $checkLinkGuidance = $false }
|
||||
|
||||
[string[]] $linkUris = GetLinks $pageUri
|
||||
Write-Host "Checking $($linkUris.Count) links found on page $pageUri";
|
||||
$badLinksPerPage = @();
|
||||
@ -561,6 +568,8 @@ while ($pageUrisToCheck.Count -ne 0)
|
||||
} catch {
|
||||
Write-Host "Exception encountered while processing pageUri $pageUri : $($_.Exception)"
|
||||
throw
|
||||
} finally {
|
||||
$checkLinkGuidance = $originalcheckLinkGuidance
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user