Skip to content

Commit

Permalink
Remove get-codeowners.ps1 from docs automation (#7040)
Browse files Browse the repository at this point in the history
* Remove codeowners resolution logic from docs scripts

* Remove parameters that aren't needed

* Fix test expectations to exclude metadata that's been removed

* Remove auth information from update-docsms-metadata.yml

* Fix notification-configuration.sln
  • Loading branch information
danieljurek authored Oct 2, 2023
1 parent 2e0c427 commit 95ba08b
Show file tree
Hide file tree
Showing 42 changed files with 216 additions and 1,720 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
| Reference | Package | Source |
|---|---|---|
|Communication Chat|[azure-communication-chat](azure-communication-chat/test)|[Github](github.com)|
|Communication Identity|[azure-communication-identity](azure-communication-identity/test)|[Github](github.com/blob/main/sdk/communication/azure-communication-identity)|
|Communication Network Traversal|[azure-communication-networktraversal](azure-communication-networktraversal/test)|[Github](github.com/blob/main/sdk/communication/azure-communication-networktraversal)|
|Communication Phone Numbers|[azure-communication-phonenumbers](azure-communication-phonenumbers/test)|[Github](github.com)|
|Communication Sms|[azure-communication-sms](azure-communication-sms/test)|[Github](github.com)|
|Resource Management - Communication|[azure-mgmt-communication](azure-mgmt-communication/test)|[Github](github.com)|
| Reference | Package | Source |
|---|---|---|
|Communication Chat|[azure-communication-chat](azure-communication-chat/test)|[GitHub](github.com)|
|Communication Network Traversal|[azure-communication-networktraversal](azure-communication-networktraversal/test)|[GitHub](github.com/blob/main/sdk/communication/azure-communication-networktraversal)|
|Communication Phone Numbers|[azure-communication-phonenumbers](azure-communication-phonenumbers/test)|[GitHub](github.com)|
|Communication Sms|[azure-communication-sms](azure-communication-sms/test)|[GitHub](github.com)|
|Resource Management - Communication|[azure-mgmt-communication](azure-mgmt-communication/test)|[GitHub](github.com)|
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
title: Azure service name 4 SDK for Unknown
description: Reference for Azure service name 4 SDK for Unknown
author: github-alias
ms.author: msalias
ms.data: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
---
# Azure service name 4 SDK for Unknown - preview
## Packages - preview
---
title: Azure service name 4 SDK for Unknown
description: Reference for Azure service name 4 SDK for Unknown
ms.date: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
---
# Azure service name 4 SDK for Unknown - preview
## Packages - preview
[!INCLUDE [packages](service-name-3-index.md)]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
| Reference | Package | Source |
|---|---|---|
|Communication Chat|[azure-communication-chat](azure-communication-chat/test)|[Github](github.com)|
|Communication Network Traversal|[azure-communication-networktraversal](azure-communication-networktraversal/test)|[Github](github.com/blob/main/sdk/communication/azure-communication-networktraversal)|
|Communication Phone Numbers|[azure-communication-phonenumbers](azure-communication-phonenumbers/test)|[Github](github.com)|
|Communication Sms|[azure-communication-sms](azure-communication-sms/test)|[Github](github.com)|
|Resource Management - Communication|[azure-mgmt-communication](azure-mgmt-communication/test)|[Github](github.com)|
| Reference | Package | Source |
|---|---|---|
|Communication Chat|[azure-communication-chat](azure-communication-chat/test)|[GitHub](github.com)|
|Communication Network Traversal|[azure-communication-networktraversal](azure-communication-networktraversal/test)|[GitHub](github.com/blob/main/sdk/communication/azure-communication-networktraversal)|
|Communication Phone Numbers|[azure-communication-phonenumbers](azure-communication-phonenumbers/test)|[GitHub](github.com)|
|Communication Sms|[azure-communication-sms](azure-communication-sms/test)|[GitHub](github.com)|
|Resource Management - Communication|[azure-mgmt-communication](azure-mgmt-communication/test)|[GitHub](github.com)|
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
---
title: Azure service name 5 SDK for Unknown
description: Reference for Azure service name 5 SDK for Unknown
ms.date: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
---
This is testing
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
| Reference | Package | Source |
|---|---|---|
|Communication Chat|[azure-communication-chat](azure-communication-chat/test)|[Github](github.com)|
|Communication Identity|[azure-communication-identity](azure-communication-identity/test)|[Github](github.com/blob/main/sdk/communication/azure-communication-identity)|
|Communication Network Traversal|[azure-communication-networktraversal](azure-communication-networktraversal/test)|[Github](github.com/blob/main/sdk/communication/azure-communication-networktraversal)|
|Communication Phone Numbers|[azure-communication-phonenumbers](azure-communication-phonenumbers/test)|[Github](github.com)|
|Communication Sms|[azure-communication-sms](azure-communication-sms/test)|[Github](github.com)|
|Resource Management - Communication|[azure-mgmt-communication](azure-mgmt-communication/test)|[Github](github.com)|
| Reference | Package | Source |
|---|---|---|
|Communication Chat|[azure-communication-chat](azure-communication-chat/test)|[GitHub](github.com)|
|Communication Network Traversal|[azure-communication-networktraversal](azure-communication-networktraversal/test)|[GitHub](github.com/blob/main/sdk/communication/azure-communication-networktraversal)|
|Communication Phone Numbers|[azure-communication-phonenumbers](azure-communication-phonenumbers/test)|[GitHub](github.com)|
|Communication Sms|[azure-communication-sms](azure-communication-sms/test)|[GitHub](github.com)|
|Resource Management - Communication|[azure-mgmt-communication](azure-mgmt-communication/test)|[GitHub](github.com)|
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
title: Azure service name 6 SDK for Unknown
description: Reference for Azure service name 6 SDK for Unknown
author: github-alias
ms.author: msalias
ms.data: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
---
# Azure service name 6 SDK for Unknown - preview
## Packages - preview
---
title: Azure service name 6 SDK for Unknown
description: Reference for Azure service name 6 SDK for Unknown
ms.date: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
---
# Azure service name 6 SDK for Unknown - preview
## Packages - preview
[!INCLUDE [packages](service-name-5-index.md)]
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: Azure service name 2 SDK for Unknown
description: Reference for Azure service name 2 SDK for Unknown
author: github-alias
ms.author: msalias
ms.data: 2022-11-01
ms.date: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: Azure service name 4 SDK for Unknown
description: Reference for Azure service name 4 SDK for Unknown
author: github-alias
ms.author: msalias
ms.data: 2022-11-01
ms.date: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: Azure service name 1 SDK for Unknown
description: Reference for Azure service name 1 SDK for Unknown
author: github-alias
ms.author: msalias
ms.data: 2022-11-01
ms.date: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: Azure service name 3 SDK for Unknown
description: Reference for Azure service name 3 SDK for Unknown
author: github-alias
ms.author: msalias
ms.data: 2022-11-01
ms.date: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: Azure service name 5 SDK for Unknown
description: Reference for Azure service name 5 SDK for Unknown
author: github-alias
ms.author: msalias
ms.data: 2022-11-01
ms.date: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: Azure service name 6 SDK for Unknown
description: Reference for Azure service name 6 SDK for Unknown
author: github-alias
ms.author: msalias
ms.data: 2022-11-01
ms.date: 2022-11-01
ms.topic: reference
ms.devlang: Unknown
ms.service: ms-service
Expand Down
46 changes: 0 additions & 46 deletions eng/common-tests/get-codeowners/get-codeowners.tests.ps1

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ steps:
-Language '${{parameters.Language}}' `
-RepoId '${{ parameters.RepoId }}' `
-DocValidationImageId '${{ parameters.DocValidationImageId }}' `
-PackageSourceOverride '${{ parameters.PackageSourceOverride }}' `
-TenantId '$(opensource-aad-tenant-id)' `
-ClientId '$(opensource-aad-app-id)' `
-ClientSecret '$(opensource-aad-secret)'
-PackageSourceOverride '${{ parameters.PackageSourceOverride }}'
displayName: Apply Documentation Updates
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
Expand Down
54 changes: 8 additions & 46 deletions eng/common/scripts/Helpers/Metadata-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,6 @@ function Generate-AadToken ($TenantId, $ClientId, $ClientSecret)
return $resp.access_token
}

function GetMsAliasFromGithub ([string]$TenantId, [string]$ClientId, [string]$ClientSecret, [string]$GithubUser)
{
# API documentation (out of date): https://github.com/microsoft/opensource-management-portal/blob/main/docs/api.md
$OpensourceAPIBaseURI = "https://repos.opensource.microsoft.com/api/people/links/github/$GithubUser"

$Headers = @{
"Content-Type" = "application/json"
"api-version" = "2019-10-01"
}

try {
$opsAuthToken = Generate-AadToken -TenantId $TenantId -ClientId $ClientId -ClientSecret $ClientSecret
$Headers["Authorization"] = "Bearer $opsAuthToken"
Write-Host "Fetching aad identity for github user: $GithubUser"
$resp = Invoke-RestMethod $OpensourceAPIBaseURI -Method 'GET' -Headers $Headers -MaximumRetryCount 3
} catch {
Write-Warning $_
return $null
}

$resp | Write-Verbose

if ($resp.aad) {
Write-Host "Fetched aad identity $($resp.aad.alias) for github user $GithubUser. "
return $resp.aad.alias
}
Write-Warning "Failed to retrieve the aad identity from given github user: $GithubName"
return $null
}

function GetAllGithubUsers ([string]$TenantId, [string]$ClientId, [string]$ClientSecret)
{
# API documentation (out of date): https://github.com/microsoft/opensource-management-portal/blob/main/docs/api.md
Expand All @@ -70,17 +40,6 @@ function GetAllGithubUsers ([string]$TenantId, [string]$ClientId, [string]$Clien
return $resp
}

function GetPrimaryCodeOwner ([string]$TargetDirectory)
{
$codeOwnerArray = &"$PSScriptRoot/../get-codeowners.ps1" -TargetDirectory $TargetDirectory
if ($codeOwnerArray) {
Write-Host "Code Owners are $codeOwnerArray."
return $codeOwnerArray[0]
}
Write-Warning "No code owner found in $TargetDirectory."
return $null
}

function GetDocsMsService($packageInfo, $serviceName)
{
$service = $serviceName.ToLower().Replace(' ', '').Replace('/', '-')
Expand Down Expand Up @@ -109,18 +68,21 @@ function compare-and-merge-metadata ($original, $updated) {
return $updateMetdata
}

function GenerateDocsMsMetadata($originalMetadata, $language, $languageDisplayName, $serviceName, $author, $msAuthor, $msService)
{
function GenerateDocsMsMetadata(
$originalMetadata,
$language,
$languageDisplayName,
$serviceName,
$msService
) {
$langTitle = "Azure $serviceName SDK for $languageDisplayName"
$langDescription = "Reference for Azure $serviceName SDK for $languageDisplayName"
$date = Get-Date -Format "MM/dd/yyyy"

$metadataTable = [ordered]@{
"title"= $langTitle
"description"= $langDescription
"author"= $author
"ms.author"= $msauthor
"ms.data"= $date
"ms.date"= $date
"ms.topic"= "reference"
"ms.devlang"= $language
"ms.service"= $msService
Expand Down
Loading

0 comments on commit 95ba08b

Please sign in to comment.