name: Validate {service}'s OpenAPI spec is in sync
permissions:
contents: read
pull-requests: write
on:
push: {}
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Fetch {service} latest OpenAPI
run: |
set -o pipefail
gh api /repos/ORG/REPO/contents/docs/openapi.yml | jq .content -r | base64 -d > head.yaml
env:
GH_TOKEN: ${{ secrets.TOKEN }}
- name: Is {service}' OpenAPI up-to-date?
run: |
git diff --color --no-index a.yaml head.yaml || \
echo "::warning file=a.yaml::File is out-of-sync with upstream repo"