Ensure API docs are generated before exiting

This commit is contained in:
Mark McDowall 2025-02-19 17:00:42 -08:00
parent b22d598ebf
commit 05d57aa913
No known key found for this signature in database
2 changed files with 23 additions and 2 deletions

View file

@ -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"

10
docs.sh → scripts/docs.sh Executable file → Normal file
View file

@ -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