-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
72 lines (61 loc) · 2.56 KB
/
openapi-diff.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: openapi-diff
on:
pull_request:
# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
# hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
jobs:
check-diff:
name: build api
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Check for python file changes
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-filters.yml
- name: Setup sentry env
uses: ./.github/actions/setup-sentry
if: steps.changes.outputs.api_docs == 'true'
- name: Checkout getsentry/sentry-api-schema
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
if: steps.changes.outputs.api_docs == 'true'
with:
ref: 'main'
repository: getsentry/sentry-api-schema
path: sentry-api-schema
- uses: getsentry/action-setup-volta@e4939d337b83760d13a9d7030a6f68c9d0ee7581 # v2.0.0
if: steps.changes.outputs.api_docs == 'true'
- name: Build OpenAPI Derefed JSON
if: steps.changes.outputs.api_docs == 'true'
# install ts-node for ts build scripts to execute properly without potentially installing
# conflicting deps when running scripts locally
# see: https://github.com/getsentry/sentry/pull/32328/files
run: |
yarn add ts-node && make build-api-docs
- name: Compare OpenAPI Derefed JSON
if: steps.changes.outputs.api_docs == 'true'
run: |
npx [email protected] --color sentry-api-schema/openapi-derefed.json tests/apidocs/openapi-derefed.json
- name: Dump RPC schema for new version
id: newschema
if: steps.changes.outputs.api_docs == 'true'
run: |
mkdir schemas
sentry rpcschema --partial > rpc_method_schema.json
- name: Compare RPC schema with oasdiff
uses: oasdiff/oasdiff-action/breaking@fc826b9f0d21b85b085842521c7a8cc445412c08 # v0.0.19
if: steps.changes.outputs.api_docs == 'true'
with:
base: sentry-api-schema/rpc_method_schema.json
revision: ./rpc_method_schema.json
format: 'text'
fail-on-diff: true