test diff #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Swagger notiication | |
on: | |
push: | |
branches: | |
- swagger_docs | |
workflow_dispatch: | |
branches: | |
- swagger_docs | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
outputs: | |
json-file: ${{ steps.json.outputs.changes }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: dorny/paths-filter@v3 | |
id: json | |
with: | |
base: ${{ github.ref }} | |
filters: | | |
latest: | |
- 'latest.json' | |
staging: | |
- 'staging.json' | |
production: | |
- 'production.json' | |
diff: | |
name: OpenAPI diff | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
# if: ${{ needs.changes.outputs.json-file != '[]' && needs.changes.outputs.json-file != '' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
changed-apis: ${{ fromJSON(needs.changes.outputs.json-file) }} | |
steps: | |
- name: Check out head branch | |
uses: actions/checkout@v4 | |
with: | |
path: head | |
- name: Check out swagger_docs branch | |
uses: actions/checkout@v4 | |
with: | |
ref: swagger_docs | |
path: base | |
fetch-depth: 2 | |
- name: Check out swagger_docs branch | |
run: cd base && git checkout HEAD^ | |
- name: Run OpenAPI Diff (from HEAD revision) | |
uses: docker://openapitools/openapi-diff:latest | |
with: | |
args: --json diff.json --text diff.txt base/${JSON_FILE}.json head/${JSON_FILE}.json | |
env: | |
JSON_FILE: ${{ matrix.changed-apis }} | |
- name: print diff | |
run: | | |
slack.sh ${{ matrix.changed-apis }} | |
env: | |
SLACK_WEBHOOK: ${{ secrets.API_SLACK_WEBHOOK_URL }} | |
# - name: Upload to slack step | |
# uses: adrey/slack-file-upload-action@master | |
# with: | |
# token: ${{ secrets.SLACK_BOT_TOKEN }} | |
# path: diff.json | |
# channel: fx_api_changes |