I couldn't get https://github.com/evereepay/openapi-diff-action to work for me, so ended up doing it a bit more manually, by invoking directly https://github.com/quen2404/openapi-diff and generating a comment for the PR with https://github.com/actions/github-script
To do that you need :
- the script
check-openapi-diff.sh
... in my case it is in the.ci
folder at the root of our repo - the GitHub Actions workflow
openapi.yaml
. It needs to be under the folder.github/workflows
of the repo - possibly adapt some paths here and there in the
openapi.yaml
file
If everything goes well, you'll get comments on you PRs such as :
ℹ️ This is not preventing you from merging, you are an adult.
Changed content type : application/json
New required properties:
thisIsANewRequiredProp
- Added property
thisIsANewRequiredProp
(boolean)
comparing /home/runner/work/xxxx/xxxx/base/docs/swagger.yaml
with /home/runner/work/xxxx/xxxxx/head/docs/swagger.yaml
.
or
ℹ️ This is not preventing you from merging, you are an adult.
Changed content type : application/json
- Added property
newOptionalProp
(string)
comparing /home/runner/work/xxxx/xxx/base/docs/swagger.yaml
with /home/runner/work/xxxx/xxxx/head/docs/swagger.yaml
.
or
ℹ️ This is not preventing you from merging, you are an adult.
comparing /home/runner/work/xxxx/xxxx/base/docs/swagger.yaml
with /home/runner/work/xxxx/xxxx/head/docs/swagger.yaml
.
Thanks a lot for the script. Getting a:
/home/runner/work/_temp/4704e061-c75c-432b-8c99-ffb5426ad0c6.sh: line 1: head/brokkoli_backend/scripts/check-openapi-diff.sh: Permission denied