Skip to content

Commit

Permalink
add warning on breaking change to api
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard87 committed Dec 11, 2023
1 parent 2b2021d commit 33bc195
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 34 deletions.
25 changes: 11 additions & 14 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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
Expand Down
13 changes: 11 additions & 2 deletions swaggerui/html/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -7384,4 +7393,4 @@
"bearer": []
}
]
}
}
18 changes: 0 additions & 18 deletions swaggerui/swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit 33bc195

Please sign in to comment.