-
Notifications
You must be signed in to change notification settings - Fork 5
76 lines (66 loc) · 2.76 KB
/
pull_request_merge_checks.yaml
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
73
74
75
76
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
name: Check API Contracts
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- uses: actions/setup-node@v2
with:
node-version: '20'
- name: Get changed yaml files
id: changed-files-specific
uses: tj-actions/changed-files@v34
with:
files: |
io/**/*.yaml
io/**/*.yml
io/**/*.json
files_ignore: kafka.yaml #skipping it as async is under private-beta
- name: Get changed GraphQLS files
id: changed-graphqls-files
uses: tj-actions/changed-files@v34
with:
files: |
io/**/*.graphqls
- name: Install Spectral Linter
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: npm install -g @stoplight/spectral-cli
- name: Run Spectral linter on changed files
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "Running Spectral linter on: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
spectral lint io/**/*.yaml
- name: Create environment file
run: |
echo "GITHUB_REF=${{ github.ref }}" >> env.list
echo "GITHUB_SHA=${{ github.sha }}" >> env.list
echo "GITHUB_REPOSITORY=${{ github.repository }}" >> env.list
echo "GITHUB_ACTOR=${{ github.actor }}" >> env.list
echo "GITHUB_WORKFLOW=${{ github.workflow }}" >> env.list
echo "GITHUB_HEAD_REF=${{ github.head_ref }}" >> env.list
echo "GITHUB_BASE_REF=${{ github.base_ref }}" >> env.list
- name: Run OpenAPI backward compatibility check on changed files
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
docker run -v "$(pwd):/central-contract-repo:rw" \
--env-file env.list \
--entrypoint /bin/sh znsio/specmatic \
-c "git config --global --add safe.directory /central-contract-repo && cd /central-contract-repo && java -jar /usr/src/app/specmatic.jar backwardCompatibilityCheck"
- name: Run GraphQL backward compatibility check on changed files
if: steps.changed-graphqls-files.outputs.any_changed == 'true'
run: |
docker run -v "$(pwd):/central-contract-repo:rw" \
--env-file env.list \
--entrypoint /bin/sh \
znsio/specmatic-graphql-trial \
-c "git config --global --add safe.directory /central-contract-repo && cd /central-contract-repo && java -jar /usr/bin/specmatic-graphql.jar backwardCompatibilityCheck"