Browse Source

feat: Github Action to compare changes in openapi-derefed.json (#21192)

NisanthanNanthakumar 4 years ago
parent
commit
6221ebb13a
1 changed files with 42 additions and 0 deletions
  1. 42 0
      .github/workflows/openapi-diff.yml

+ 42 - 0
.github/workflows/openapi-diff.yml

@@ -0,0 +1,42 @@
+name: openapi-diff
+on:
+  pull_request:
+    paths:
+      - 'api-docs/**'
+
+jobs:
+    check-diff:
+      runs-on: ubuntu-18.04
+      steps:
+        - name: Checkout getsentry/sentry
+          uses: actions/checkout@v2
+          with:
+            path: sentry
+
+        - name: Getsentry Token
+          id: getsentry
+          uses: getsentry/action-github-app-token@v1
+          with:
+            app_id: ${{ secrets.SENTRY_INTERNAL_APP_ID }}
+            private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
+
+        - name: Checkout getsentry/sentry-api-schema
+          uses: actions/checkout@v2
+          with:
+            ref: 'main'
+            repository: getsentry/sentry-api-schema
+            path: sentry-api-schema
+            token: ${{ steps.getsentry.outputs.token }}
+
+        - name: Install/setup node
+          uses: volta-cli/action@v1
+
+        - name: Build OpenAPI Derefed JSON
+          run: |
+            cd sentry
+            yarn install --frozen-lockfile
+            yarn run build-derefed-docs api-docs/openapi-derefed.json
+
+        - name: Compare OpenAPI Derefed JSON
+          run: |
+            npx json-diff --color sentry/api-docs/openapi-derefed.json sentry-api-schema/openapi-derefed.json