@@ -12,10 +12,22 @@ jobs:
1212 uses : mhiew/redoc-lint-github-action@v4
1313 with :
1414 args : ' openapi/task_execution_service.openapi.yaml'
15+ validate :
16+ name : Validate OpenAPI definition
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Check out head branch
20+ uses : actions/checkout@v4
21+ - name : Run OpenAPI Validate Action
22+ uses : swaggerexpert/swagger-editor-validate@v1
23+ with :
24+ definition-file : openapi/task_execution_service.openapi.yaml
25+
1526 diff :
1627 name : Show OpenAPI differences relative to target branch
1728 runs-on : ubuntu-latest
18- if : ${{ github.event_name == 'pull_request' }}
29+ outputs :
30+ diff_generated : ${{ steps.upload-log.outputs.artifact_id }}
1931 steps :
2032 - name : Check out head branch
2133 uses : actions/checkout@v4
@@ -27,19 +39,39 @@ jobs:
2739 with :
2840 ref : ${{ github.event.pull_request.base.ref }}
2941 path : base
30- - name : Run OpenAPI Diff Action
31- uses : mvegter/openapi-diff-action@v0.23.5
42+ - name : Create output directory
43+ run : mkdir -p diff-artifacts/
44+ - name : Pull Docker Image
45+ run : docker pull openapitools/openapi-diff:2.0.1
46+ - name : Run openapi-diff tool
47+ run : |
48+ docker run --rm \
49+ -v $(pwd)/head:/head:ro \
50+ -v $(pwd)/base:/base:ro \
51+ -v $(pwd)/diff-artifacts:/local \
52+ openapitools/openapi-diff:2.0.1 \
53+ /head/openapi/task_execution_service.openapi.yaml \
54+ /base/openapi/task_execution_service.openapi.yaml \
55+ --markdown /local/diff.md 2> diff-artifacts/error.log
56+ - name : Get PR number
57+ id : get-pr-number
58+ run : |
59+ echo "${{ github.event.pull_request.number }}" > diff-artifacts/pr_number
60+ - name : Upload artifacts
61+ uses : actions/upload-artifact@v4
3262 with :
33- head-spec : head/openapi/task_execution_service.openapi.yaml
34- base-spec : base/openapi/task_execution_service.openapi.yaml
63+ name : diff-artifacts
64+ path : diff-artifacts/
65+ if-no-files-found : ignore
66+ - name : Check if OpenAPI Diff failed
67+ id : check-diff
68+ run : |
69+ if [ -s diff-artifacts/error.log ]; then
70+ echo "The diff failed. Please see artifact error.log."
71+ exit 1
72+ fi
3573
36- validate :
37- name : Validate OpenAPI definition
38- runs-on : ubuntu-latest
39- steps :
40- - name : Check out head branch
41- uses : actions/checkout@v4
42- - name : Run OpenAPI Validate Action
43- uses : char0n/swagger-editor-validate@v1
44- with :
45- definition-file : openapi/task_execution_service.openapi.yaml
74+ permissions :
75+ contents : read
76+ pull-requests : write
77+ issues : write
0 commit comments