From 33bc195f6ebf7960c7c94ac5394bdc6700c5854c Mon Sep 17 00:00:00 2001 From: Richard Hagen Date: Mon, 11 Dec 2023 12:57:11 +0100 Subject: [PATCH] add warning on breaking change to api --- .github/workflows/pr.yaml | 25 +++++++++++-------------- swaggerui/html/swagger.json | 13 +++++++++++-- swaggerui/swagger.go | 18 ------------------ 3 files changed, 22 insertions(+), 34 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index c5210472..31d4532b 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -30,7 +30,7 @@ jobs: - name: Go Vet run: go vet `go list ./... | grep -v "pkg/client"` test: - name: Test + name: Unit Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -46,7 +46,7 @@ jobs: name: Test Swagger runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: '1.21' @@ -55,24 +55,21 @@ jobs: - name: Install Swagger run: go install github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5 - name: Generate Swagger - run: make swagger + run: swagger generate spec -o ./swagger.json --scan-models --exclude-deps - name: Validate no changes - run: git diff --exit-code ./swaggerui/html/swagger.json + run: diff swagger.json ./swaggerui/html/swagger.json - name: Check breaking changes + if: always() id: breaking - run: | - echo "diff=$(swagger diff --quiet --break <(git show HEAD~1:swaggerui/html/swagger.json) ./swaggerui/html/swagger.json)\n" >> $GITHUB_OUTPUT + continue-on-error: true + run: swagger diff --break <(git show master:swaggerui/html/swagger.json) swagger.json > /tmp/swagger_breaking_changes.txt - name: Add comment - if: always() + if: failure() && steps.breaking.outcome == 'failure' uses: mshick/add-pr-comment@v2 with: - message: | - Swagger have breaking changes: - ```text - ${{ steps.breaking.outputs.diff }} - ``` - - + message-id: breaking-comment + preformatted: true + message-path: /tmp/swagger_breaking_changes.txt build: name: Build diff --git a/swaggerui/html/swagger.json b/swaggerui/html/swagger.json index 6872df57..96c53f36 100644 --- a/swaggerui/html/swagger.json +++ b/swaggerui/html/swagger.json @@ -7267,7 +7267,16 @@ }, "status": { "description": "Status of the step", - "type": "number", + "type": "string", + "enum": [ + "Queued", + "Waiting", + "Running", + "Succeeded", + "Failed", + "Stopped", + "StoppedNoChanges" + ], "x-go-name": "Status", "example": "Waiting" } @@ -7384,4 +7393,4 @@ "bearer": [] } ] -} +} \ No newline at end of file diff --git a/swaggerui/swagger.go b/swaggerui/swagger.go index 278f81d6..70fb0c14 100644 --- a/swaggerui/swagger.go +++ b/swaggerui/swagger.go @@ -3,24 +3,6 @@ package swaggerui import ( "embed" "io/fs" - // Required to include swagger dependencies - // _ "github.com/Masterminds/sprig/v3" - // _ "github.com/go-openapi/analysis" - // _ "github.com/go-openapi/errors" - // _ "github.com/go-openapi/inflect" - // _ "github.com/go-openapi/loads" - // _ "github.com/go-openapi/loads/fmts" - // _ "github.com/go-openapi/runtime" - // _ "github.com/go-openapi/spec" - // _ "github.com/go-openapi/strfmt" - // _ "github.com/go-openapi/validate" - // _ "github.com/go-swagger/go-swagger" - // _ "github.com/jessevdk/go-flags" - // _ "github.com/toqueteos/webbrowser" - // - // _ "github.com/go-swagger/go-swagger/cmd/swagger/commands" - // _ "github.com/go-swagger/go-swagger/codescan" - // _ "github.com/go-swagger/go-swagger/generator" _ "github.com/go-swagger/go-swagger" )