forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (41 loc) · 1.85 KB
/
openapi-schema-check.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
name: OpenAPI dev mode check
# **What it does**: Checks that the files in lib/rest/static/decorated match
# the files in lib/rest/static/dereferenced. Checks that the decorated
# schemas in lib/rest/static/decorated are not in development mode.
# Development mode schemas have a branch name and development mode tag in the
# info.version property.
# **Why we have it**: To ensure that we aren't every shipping decorated schemas
# that are out of sync with the source derefereced schema. To ensure that
# decorated schemas generated locally are not published. Locally generated
# decorated schemas are pushing up to the remote for staging purposes only.
# **Who does it impact**: Docs content writers updating REST API docs and
# the docs engineering team as maintainers of the scripts and workflows.
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
paths:
- 'lib/rest/static/**'
- 'script/rest/**/*.js'
- 'package*.json'
jobs:
check-schema-versions:
if: ${{ github.repository == 'github/docs-internal' }}
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
steps:
- name: Checkout repository code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Setup node
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f
with:
node-version: 16.8.x
cache: npm
- name: Install dependencies
run: npm ci
# Differences between decorated and dereferenced files indicates a problem
- name: Generate decorated files to check that there are no differences
run: script/rest/update-files.js --decorate-only
- name: Check if deref/decorated schemas are dev mode and that they match
run: .github/actions-scripts/openapi-schema-branch.js