Descend from the alps/swagger api view #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Swagger APIView | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
AzureSdkForNetDevOpsFeed: | |
description: 'Azure SDK for .NET DevOps Feed' | |
default: 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json' | |
SwaggerApiParserVersion: | |
description: 'Swagger API Parser Version' | |
default: '1.3.0-dev.20241029.2' | |
APIViewArtifactsDirectoryName: | |
description: 'APIView Artifacts Directory Name' | |
default: 'SwaggerAPIViewArtifacts' | |
APIViewArtifactsName: | |
description: 'APIView Artifacts Name' | |
default: 'swaggerAPIViewArtifacts' | |
APIViewAPIUri: | |
description: 'URI for APIView Creation Endpoint' | |
default: 'https://apiviewstagingtest.com/PullRequest/DetectAPIChanges' | |
PullRequestRef: | |
description: 'Pull Request ref' | |
default: 'refs/pull/5/merge' | |
PullRequestNumber: | |
description: 'Pull Request Number' | |
default: '5' | |
env: | |
AzureSdkForNetDevOpsFeed: ${{ github.event.inputs.AzureSdkForNetDevOpsFeed || 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json' }} | |
SwaggerApiParserVersion: ${{ github.event.inputs.SwaggerApiParserVersion || '1.3.0-dev.20241029.2' }} | |
APIViewArtifactsDirectoryName: ${{ github.event.inputs.APIViewArtifactsDirectoryName || 'SwaggerAPIViewArtifacts' }} | |
APIViewArtifactsName: ${{ github.event.inputs.APIViewArtifactsName || 'swaggerAPIViewArtifacts' }} | |
APIViewAPIUri: ${{ github.event.inputs.APIViewAPIUri || 'https://apiview.dev/PullRequest/DetectAPIChanges' }} | |
PullRequestRef: ${{ github.event.pull_request.head.ref || github.event.inputs.PullRequestRef }} | |
PullRequestNumber: ${{ github.event.pull_request.number || github.event.inputs.PullRequestNumber }} | |
jobs: | |
generate-apiview-artifact: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.PullRequestRef }} | |
fetch-depth: 0 | |
- name: Install .NET SDK | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: '8.x' | |
- name: Install APIView Swagger Parser | |
run: | | |
dotnet tool install Azure.Sdk.Tools.SwaggerApiParser \ | |
--version ${{ env.SwaggerApiParserVersion }} \ | |
--add-source ${{ env.AzureSdkForNetDevOpsFeed }} \ | |
--global | |
- name: Generate Swagger APIView Tokens | |
shell: pwsh | |
run: | | |
eng/scripts/Create-Swagger-APIView-Artifacts.ps1 ` | |
-TempDirectory ${{ github.workspace }}/temp ` | |
-ArtiFactsStagingDirectory ${{ github.workspace }}/artifacts ` | |
-APIViewArtifactsDirectoryName ${{ env.APIViewArtifactsDirectoryName }} | |
env: | |
DOTNET_ROOT: /home/runner/.dotnet | |
- name: Publish Swagger APIView Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.APIViewArtifactsName }} | |
path: ${{ github.workspace }}/artifacts/${{ env.APIViewArtifactsDirectoryName }} | |
create-apiview: | |
runs-on: ubuntu-latest | |
needs: generate-apiview-artifact | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.PullRequestRef }} | |
fetch-depth: 0 | |
- name: Create Swagger APIView | |
shell: pwsh | |
run: | | |
eng/scripts/Create-Swagger-APIView.ps1 ` | |
-ArtiFactsStagingDirectory ${{ github.workspace }}/artifacts ` | |
-APIViewArtifactsDirectoryName ${{ env.APIViewArtifactsDirectoryName }} ` | |
-APIViewArtifactsName ${{ env.APIViewArtifactsName }} ` | |
-APIViewUri ${{ env.APIViewAPIUri }} ` | |
-BuildId ${{ github.run_id }} ` | |
-RepoName ${{ github.repository }} ` | |
-PullRequestNumber ${{ env.PullRequestNumber }} ` | |
-Language 'Swagger' ` | |
-CommitSha ${{ github.sha }} |