Merge pull request #1490 from qdraw/snyk-upgrade-9ce52fbf9e553efbfef8… #1041
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: 'Update Swagger definitions' | |
on: | |
workflow_dispatch: | |
push: | |
branches: [master] | |
paths: | |
- '**.cshtml' | |
- '**.cs' | |
- '**.sln' | |
- '**.cake' | |
- '**.json' | |
- '.github/workflows/auto-update-swagger-dotnet.yml' | |
- 'starsky-tools/build-tools/app-version-update.js' | |
pull_request: | |
branches: [ master ] | |
paths: | |
- '.github/workflows/auto-update-swagger-dotnet.yml' | |
- 'documentation/static/openapi/openapi.json' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.202 | |
- name: Cache nuget packages (*nix) | |
uses: actions/cache@v4 | |
with: | |
# nuget cache files are stored in `~/.nuget/packages` on Linux/macOS | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-build-netcore-${{ hashFiles('./starsky/starsky/nuget-packages-list.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-netcore- | |
- name: Run With Exit | |
shell: bash | |
working-directory: ./starsky/starsky | |
env: | |
app__AddSwagger: "true" | |
app__AddSwaggerExport: "true" | |
app__AddSwaggerExportExitAfter: "true" | |
app__SyncOnStartup: "false" | |
app__thumbnailGenerationIntervalInMinutes: 0 | |
app__EnablePackageTelemetry: "false" | |
app__useDiskWatcher: "false" | |
app__GeoFilesSkipDownloadOnStartup: "true" | |
app__ExiftoolSkipDownloadOnStartup: "true" | |
run: dotnet run --no-launch-profile | |
- name: Copy | |
shell: bash | |
run: cp starsky/starsky/bin/Debug/net*.0/temp/starsky.json documentation/static/openapi/openapi.json | |
- name: Generate swagger | |
shell: bash | |
working-directory: ./documentation | |
run: node scripts/openapi.js | |
- name: Commit changes openapi.json (if push to branch) | |
uses: EndBug/add-and-commit@v9 | |
if: github.event_name != 'pull_request' | |
with: | |
author_name: SwaggerUpdateBot | |
author_email: [email protected] | |
message: "[Swagger] Auto commited swagger/openapi list" | |
add: "documentation/static/openapi/openapi.json" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit changes docs/api/readme.md (if push to branch) | |
uses: EndBug/add-and-commit@v9 | |
if: github.event_name != 'pull_request' | |
with: | |
author_name: SwaggerUpdateBot | |
author_email: [email protected] | |
message: "[Swagger] Auto commited swagger/openapi list" | |
add: "docs/api/readme.md" | |
github_token: ${{ secrets.GITHUB_TOKEN }} |