Skip to content

✨ QRCode API

✨ QRCode API #82

Workflow file for this run

name: update-docs
on:
pull_request:
merge_group:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Graphviz
uses: tlylt/install-graphviz@v1
- name: Set up Node LTS
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Generate Swagger documentation
run: npm run doc
- name: Check if documentation files has changed
id: verify-changed-files
uses: tj-actions/verify-changed-files@v17
with:
files: docs/openapi.json
- name: Update documentation files
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
SPEC_TO_DISPLAY: "openapi.json"
DISABLE_TRY_IT_OUT_JS_METHOD: "const DisableTryItOutPlugin = function() {return {statePlugins:{spec:{wrapSelectors:{allowTryItOutFor:() => () => false}}}}}"
DISABLE_TRY_IT_OUT_PLUGIN: ", DisableTryItOutPlugin"
run: |
yes | cp -rf node_modules/swagger-ui-dist/* docs
sed -i "/window\.onload\s=\sfunction()\s{/a $DISABLE_TRY_IT_OUT_JS_METHOD" docs/swagger-initializer.js
sed -i "s#https://petstore\.swagger\.io/v2/swagger\.json#$SPEC_TO_DISPLAY#g" docs/swagger-initializer.js
sed -i "/SwaggerUIBundle\.plugins\.DownloadUrl/a $DISABLE_TRY_IT_OUT_PLUGIN" docs/swagger-initializer.js
- name: Commit updated documentation files
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: EndBug/add-and-commit@v9
with:
add: docs
message: 'chore: update documentation'