-
Notifications
You must be signed in to change notification settings - Fork 3
50 lines (48 loc) · 1.89 KB
/
openapi-staff-portal-api.yml
File metadata and controls
50 lines (48 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: OpenAPI Generate - Staff Portal API
on:
push:
branches:
- "**"
tags-ignore:
- '**'
workflow_dispatch:
jobs:
openapi-publish:
name: OpenAPI Generate - Staff Portal API
runs-on: ubuntu-latest
defaults:
run:
working-directory: openg2p-pbms-staff-portal-api
steps:
- uses: actions/checkout@v3
- name: Get branch name (merge)
run: |
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
- name: Setup python for openapi generate
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install app
run: |
python -m pip install git+https://github.com/openg2p/openg2p-fastapi-common@1.1\#subdirectory=openg2p-fastapi-common
python -m pip install git+https://github.com/openg2p/openg2p-fastapi-common@1.1\#subdirectory=openg2p-fastapi-auth
python -m pip install ../openg2p-pbms-models
python -m pip install ../openg2p-bg-task-models
python -m pip install .
- name: Generate openapi json
run: |
mkdir -p api-docs/generated
python3 main.py getOpenAPI api-docs/generated/openapi.json
if ! [ -z "$(git status --porcelain=v1 2>/dev/null -- openg2p-pbms-staff-portal-api/api-docs/generated/openapi.json)" ]; then
shopt -s nocasematch
if [[ ${{ github.repository_owner }} == 'OpenG2P' ]]; then
export OPENAPI_CHANGED="true"
echo OPENAPI_CHANGED=$OPENAPI_CHANGED >> $GITHUB_ENV
fi
fi
- name: Commit Changes
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
message: "Generated new openapi.json for Staff Portal API on push to ${{ github.event.inputs.git-ref }}"
add: "openg2p-pbms-staff-portal-api/api-docs/generated/openapi.json"