diff --git a/eng/pipelines/apiview-review-gen-cadl.yml b/eng/pipelines/apiview-review-gen-cadl.yml
index 548f898648f..720784feaef 100644
--- a/eng/pipelines/apiview-review-gen-cadl.yml
+++ b/eng/pipelines/apiview-review-gen-cadl.yml
@@ -58,6 +58,7 @@ jobs:
-Reviews "$(Reviews)"
-OutputDir "$(Build.ArtifactStagingDirectory)"
-WorkingDir "$(Pipeline.Workspace)"
+ -GitPat "$(github-access-token)"
- task: PublishBuildArtifacts@1
inputs:
diff --git a/eng/scripts/Create-Apiview-Token-Cadl.ps1 b/eng/scripts/Create-Apiview-Token-Cadl.ps1
index cee87a8becd..a26907b873c 100644
--- a/eng/scripts/Create-Apiview-Token-Cadl.ps1
+++ b/eng/scripts/Create-Apiview-Token-Cadl.ps1
@@ -5,7 +5,8 @@ param (
[ValidateNotNullOrEmpty()]
[string] $WorkingDir,
[ValidateNotNullOrEmpty()]
- [string] $OutputDir
+ [string] $OutputDir,
+ [string] $GitPat = ""
)
Set-StrictMode -Version 3
@@ -20,7 +21,7 @@ function Sparse-Checkout($branchName, $packagePath)
}
git sparse-checkout init --cone
git sparse-checkout set $packagePath
- git checkout $BranchName
+ git checkout $branchName
}
function Generate-Apiview-File($packagePath)
@@ -70,20 +71,30 @@ if ($revs)
Write-Host "URL to Repo: '$($GitRepoName), Branch name: '$($branchName), Package Path: '$($packagePath)"
$repoDirectory = Split-Path $GitRepoName -leaf
- if (Test-Path $repoDirectory)
- {
- Write-Host "Destination path '$($repoDirectory)' already exists in working directory and is not an empty directory."
- exit 1
- }
# initialize git clone if current review is generated from different repo than previous one
if ($GitRepoName -ne $prevRepo)
{
- git clone --no-checkout --filter=tree:0 "https://github.com/$GitRepoName"
+ $gitUrl = "https://github.com"
+ if ($GitPat)
+ {
+ $gitUrl = "https://$GitPat@github.com"
+ }
+
+<<<<<<< HEAD
+ $gitUrl = "$gitUrl/$GitRepoName.git"
+ if (Test-Path $repoDirectory)
+ {
+ Write-Host "Destination path '$($repoDirectory)' already exists in working directory. Deleting '$($repoDirectory)'"
+ Remove-Item $repoDirectory -Force -Recurse
+ }
+ git clone --no-checkout --filter=tree:0 $gitUrl
+=======
+ git clone --no-checkout --filter=tree:0 "$gitUrl/$GitRepoName"
+>>>>>>> dcab34d3 (Update Git clone URL using pat)
if ($LASTEXITCODE) { exit $LASTEXITCODE }
$prevRepo = $GitRepoName
}
- $repoDirectory = Split-Path $GitRepoName -leaf
Push-Location $repoDirectory
try
{
diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Revisions.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Revisions.cshtml
index 76aac58f552..2e0168fd264 100644
--- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Revisions.cshtml
+++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Revisions.cshtml
@@ -14,11 +14,15 @@