Repository navigation
66 lines (64 loc) · 3.28 KB
/
Copy pathdocs_validate.yml
File metadata and controls
66 lines (64 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: 📃 Docfx Validate
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
- microbuild
jobs:
build:
name: 📚 Doc validation
runs-on: ubuntu-26.04
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: 🔗 Markup Link Checker (mlc)
uses: becheran/mlc@b0d0d353e04fcbcfd1d86716103d78a61e5b25dd # v1.2.2
with:
args: --do-not-warn-for-redirect-to https://learn.microsoft.com*,https://dotnet.microsoft.com/*,https://dev.azure.com/*,https://app.codecov.io/*,https://microsoft.github.io/vs-threading/* -p docfx -i https://aka.ms/onboardsupport,https://aka.ms/spot,https://msrc.microsoft.com/*,https://www.microsoft.com/msrc*,https://microsoft.com/msrc*,https://www.npmjs.com/package/*,https://get.dot.net/
- name: Authenticate to Azure with GitHub OIDC
id: azure-login
# This tenant requires enterprise-issued assertions. Other owners restore anonymously.
# Same-repository dependency update PRs authenticate; fork PRs do not.
if: github.repository_owner == 'microsoft' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: 2799af29-63f3-404f-bdcf-67ff9c70abc9
tenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
allow-no-subscriptions: true
audience: api://AzureADTokenExchange
- name: Configure Azure Artifacts credentials
if: steps.azure-login.outcome == 'success'
shell: pwsh
run: |
$accessToken = az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken --output tsv
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($accessToken)) {
throw 'Failed to acquire an Azure DevOps access token.'
}
Write-Output "::add-mask::$accessToken"
$nugetConfig = [xml](Get-Content -LiteralPath nuget.config -Raw)
$sources = @($nugetConfig.configuration.packageSources.add | Where-Object {
$_.value -match '^https://pkgs\.dev\.azure\.com/' -or $_.value -match '^https://[\w-]+\.pkgs\.visualstudio\.com/'
})
if ($sources.Count -eq 0) {
throw 'No Azure Artifacts package sources were found in nuget.config.'
}
foreach ($source in $sources) {
Add-Content -LiteralPath $env:GITHUB_ENV -Encoding utf8 -Value "NuGetPackageSourceCredentials_$($source.key)=Username=ado;Password=$accessToken;ValidAuthenticationTypes=Basic"
}
- name: ⚙ Install prerequisites
run: |
./init.ps1 -UpgradePrerequisites
dotnet --info
shell: pwsh
- name: 🏭 Build source generator # docfx build needs this to avoid a warning.
run: dotnet build -c Release src/StreamJsonRpc.Analyzers.CodeFixes
- name: 📚 Verify docfx build
run: dotnet docfx docfx/docfx.json --warningsAsErrors --disableGitFeatures
env:
DocFx: true # Workaround https://github.com/dotnet/docfx/issues/10808