-
Notifications
You must be signed in to change notification settings - Fork 20
66 lines (60 loc) · 1.97 KB
/
validate-spec.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
name: Validate API Spec
on:
push:
workflow_dispatch:
jobs:
validate:
name: Main
runs-on: ubuntu-latest
steps:
# By default, when you use actions/checkout on a PR, it will checkout the
# head commit in a detached head state. If you want to make some changes,
# you have to checkout the branch the PR is coming from in the head repo.
#
# https://github.com/EndBug/add-and-commit#working-with-prs
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
if: github.event_name == 'pull_request'
- uses: actions/checkout@v3
if: github.event_name != 'pull_request'
# Setup environment
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: yarn install
run: |
yarn install --frozen-lockfile
# Rebuild generated files and commit changes (if any)
- name: yarn generate
run: |
yarn generate
- name: Commit changes (if any)
uses: EndBug/add-and-commit@v9
with:
add: 'generated/'
message: 'chore: update generated files'
committer_name: GitHub Actions
committer_email: actions@github.com
# Lint everything
- name: yarn lint
run: |
yarn lint
# Checking for breaking changes
- name: Checkout base branch
uses: actions/checkout@v2
with:
path: _base
ref: main
- name: Check v1beta for breaking changes
uses: mvegter/openapi-diff-action@v0.23.5
with:
head-spec: generated/spec/v1beta.json
base-spec: _base/generated/spec/v1beta.json
- name: Check v1 for breaking changes
uses: mvegter/openapi-diff-action@v0.23.5
with:
head-spec: generated/spec/v1.json
base-spec: _base/generated/spec/v1.json