Skip to content

Build Push API changes #53

Build Push API changes

Build Push API changes #53

Workflow file for this run

name: OpeanAPI diff
on:
pull_request_target:
paths:
- 'rest-api/pnc-openapi.yaml'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check out head branch
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
path: head
- name: Check out master branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
path: base
- name: Run OpenAPI Diff (from HEAD revision)
id: run-diff
uses: janinko/[email protected]
with:
head-spec: head/rest-api/pnc-openapi.yaml
base-spec: base/rest-api/pnc-openapi.yaml
- name: Check changes
id: check-change
run: |
if grep "No differences. Specifications are equivalents" openapi-diff.out; then
echo "changed=no" >> $GITHUB_OUTPUT
else
echo "changed=yes" >> $GITHUB_OUTPUT
fi
- name: Comment on PR
if: steps.check-change.outputs.changed == 'yes'
uses: mshick/add-pr-comment@v2
with:
message: |
# REST API CHANGED
```
${{ steps.run-diff.outputs.diff-output }}
```
- name: Check compatibility break
if: steps.check-change.outputs.changed == 'yes'
run: |
if grep "API changes broke backward compatibility" openapi-diff.out; then
exit 1
fi