From 05d57aa91308a489873ea576c1469ea2d7d75046 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 19 Feb 2025 17:00:42 -0800 Subject: [PATCH] Ensure API docs are generated before exiting --- .github/workflows/api_docs.yml | 15 ++++++++++++++- docs.sh => scripts/docs.sh | 10 +++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) rename docs.sh => scripts/docs.sh (82%) mode change 100755 => 100644 diff --git a/.github/workflows/api_docs.yml b/.github/workflows/api_docs.yml index cd142f7e3..e657cf62e 100644 --- a/.github/workflows/api_docs.yml +++ b/.github/workflows/api_docs.yml @@ -33,7 +33,7 @@ jobs: id: setup-dotnet - name: Create openapi.json - run: ./docs.sh Linux x64 + run: ./scripts/docs.sh Linux x64 - name: Commit API Docs Change continue-on-error: true @@ -50,3 +50,16 @@ jobs: else echo "No changes since last run" fi + + - name: Notify + if: failure() + uses: tsickert/discord-webhook@v6.0.0 + with: + webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }} + username: "GitHub Actions" + avatar-url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" + embed-title: "${{ github.workflow }}: Failure" + embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + embed-description: | + Failed to update API docs + embed-color: "15158332" diff --git a/docs.sh b/scripts/docs.sh old mode 100755 new mode 100644 similarity index 82% rename from docs.sh rename to scripts/docs.sh index d93e5f889..cec577521 --- a/docs.sh +++ b/scripts/docs.sh @@ -23,7 +23,7 @@ rm -rf $outputFolder rm -rf $testPackageFolder slnFile=src/Sonarr.sln - +outputFile=src/Sonarr.Api.V5/openapi.json platform=Posix if [ "$PLATFORM" = "Windows" ]; then @@ -40,10 +40,18 @@ dotnet msbuild -restore $slnFile -p:Configuration=Debug -p:Platform=$platform -p dotnet new tool-manifest dotnet tool install --version 6.6.2 Swashbuckle.AspNetCore.Cli +# Remove the openapi.json file so we can check if it was created +rm $outputFile + dotnet tool run swagger tofile --output ./src/Sonarr.Api.V5/openapi.json "$outputFolder/$FRAMEWORK/$RUNTIME/$application" v5 & sleep 45 kill %1 +if [ ! -f $outputFile ]; then + echo "$outputFile not found, check logs for errors" + exit 1 +fi + exit 0