Skip to content

Commit 7874bc2

Browse files
committed
Removed dangling blobs
1 parent e6f8d92 commit 7874bc2

File tree

1 file changed

+42
-40
lines changed

1 file changed

+42
-40
lines changed

scripts/MsProdUpdate.ps1

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,20 @@ function Get-Files {
9494
$Uripaths = Find-MgGraphCommand -Command $Command
9595
$UriPath = $null
9696
if (-not([string]::IsNullOrEmpty($Uripaths))) {
97-
if ($Uripaths.APIVersion.Contains($ProfileGraph)) {
98-
if ($Uripaths.Length -gt 1) {
99-
$UriPath = $UriPaths.URI[0].ToString()
97+
if ($Uripaths.APIVersion.Contains($ProfileGraph)) {
98+
if ($Uripaths.Length -gt 1) {
99+
$UriPath = $UriPaths.URI[0].ToString()
100+
}
101+
else {
102+
$UriPath = $UriPaths.URI.ToString()
103+
}
104+
}
105+
if ($UriPath) {
106+
$Method = $UriPaths.Method
107+
Get-ExternalDocs-Url -GraphProfile $GraphProfile -Url -UriPath $UriPath -Command $Command -OpenApiContent $OpenApiContent -File $File -Method $Method
100108
}
101-
else {
102-
$UriPath = $UriPaths.URI.ToString()
103-
}
104-
}
105-
if ($UriPath) {
106-
$Method = $UriPaths.Method
107-
Get-ExternalDocs-Url -GraphProfile $GraphProfile -Url -UriPath $UriPath -Command $Command -OpenApiContent $OpenApiContent -File $File -Method $Method
108109
}
109110
}
110-
}
111111
#Start-Sleep -Seconds 10
112112
}
113113
}
@@ -141,35 +141,36 @@ function Get-ExternalDocs-Url {
141141
$MethodName = $Method | Out-String
142142
$ExternalDocUrl = $Path[$UriPath].values.externalDocs.url
143143

144-
if([string]::IsNullOrEmpty($ExternalDocUrl)) {
144+
if ([string]::IsNullOrEmpty($ExternalDocUrl)) {
145145
$PathSplit = $UriPath.Split("/")
146146
$PathToAppend = $PathSplit[$PathSplit.Count - 1]
147-
if($PathToAppend.StartsWith("{") -or $PathToAppend.StartsWith("$")){
148-
#skip
149-
}else{
150-
$PathRebuild = "/"+$PathSplit[0]
151-
for($i = 1; $i -lt $PathSplit.Count - 1; $i++){
152-
$PathRebuild += $PathSplit[$i]+"/"
147+
if ($PathToAppend.StartsWith("{") -or $PathToAppend.StartsWith("$")) {
148+
#skip
153149
}
154-
$RebuiltPath = $PathRebuild + "microsoft.graph." +$PathToAppend
155-
$ExternalDocUrl = $path[$RebuiltPath].get.externalDocs.url
156-
}
157-
}
158-
if ($MethodName -eq "POST") {
159-
$ExternalDocUrl = $path[$UriPath].post.externalDocs.url
160-
}
150+
else {
151+
$PathRebuild = "/" + $PathSplit[0]
152+
for ($i = 1; $i -lt $PathSplit.Count - 1; $i++) {
153+
$PathRebuild += $PathSplit[$i] + "/"
154+
}
155+
$RebuiltPath = $PathRebuild + "microsoft.graph." + $PathToAppend
156+
$ExternalDocUrl = $path[$RebuiltPath].get.externalDocs.url
157+
}
158+
}
159+
if ($MethodName -eq "POST") {
160+
$ExternalDocUrl = $path[$UriPath].post.externalDocs.url
161+
}
161162

162-
if ($MethodName -eq "PATCH") {
163-
$ExternalDocUrl = $path[$UriPath].patch.externalDocs.url
164-
}
163+
if ($MethodName -eq "PATCH") {
164+
$ExternalDocUrl = $path[$UriPath].patch.externalDocs.url
165+
}
165166

166-
if ($MethodName -eq "DELETE") {
167-
$ExternalDocUrl = $path[$UriPath].delete.externalDocs.url
168-
}
167+
if ($MethodName -eq "DELETE") {
168+
$ExternalDocUrl = $path[$UriPath].delete.externalDocs.url
169+
}
169170

170-
if ($MethodName -eq "PUT") {
171-
$ExternalDocUrl = $path[$UriPath].put.externalDocs.url
172-
}
171+
if ($MethodName -eq "PUT") {
172+
$ExternalDocUrl = $path[$UriPath].put.externalDocs.url
173+
}
173174

174175
if (-not([string]::IsNullOrEmpty($ExternalDocUrl))) {
175176
#$Url = $ExternalDocUrl.split(" ")
@@ -225,22 +226,23 @@ function WebScrapping {
225226
}
226227
}
227228
#Remove single and double qoutes from ms prod
228-
$MsprodContent = $MsprodContent.Replace("`"","")
229-
$MsprodContent = $MsprodContent.Replace("'","")
229+
$MsprodContent = $MsprodContent.Replace("`"", "")
230+
$MsprodContent = $MsprodContent.Replace("'", "")
230231
$MetaDataText = "schema: 2.0.0`r`n$MsprodContent"
231232
(Get-Content $File) |
232233
Foreach-Object { $_ -replace 'schema: 2.0.0', $MetaDataText } |
233234
Out-File $File
234235
}
235236
Set-Location microsoftgraph-docs-powershell
236237
$date = Get-Date -Format "dd-MM-yyyy"
237-
$proposedBranch = "weekly_update_help_files_"+$date
238+
$proposedBranch = "weekly_update_help_files_" + $date
238239
$exists = git branch -l $proposedBranch
239240
if ([string]::IsNullOrEmpty($exists)) {
240241
git checkout -b $proposedBranch
241-
}else{
242-
Write-Host "Branch already exists"
243-
git checkout $proposedBranch
242+
}
243+
else {
244+
Write-Host "Branch already exists"
245+
git checkout $proposedBranch
244246
}
245247
if (!(Get-Module "powershell-yaml" -ListAvailable -ErrorAction SilentlyContinue)) {
246248
Install-Module "powershell-yaml" -AcceptLicense -Scope CurrentUser -Force

0 commit comments

Comments
 (0)