-
Notifications
You must be signed in to change notification settings - Fork 50
52 lines (44 loc) · 1.65 KB
/
generate_api_docs.yaml
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
51
52
name: "Generate openapi.json"
env:
DEFAULT_PYTHON_VERSION: "3.12"
on:
pull_request:
paths: ['conda-store-server/conda_store_server/**']
jobs:
update-openapi-json:
runs-on: ubuntu-latest
# so that we can skip this job by adding 'skip openapi' to the commit message
# and only run it when the PR is against the main branch of our repo
if: "!contains(github.event.head_commit.message, '[openapi skip]') && github.repository=='conda-incubator/conda-store'"
permissions:
contents: write
defaults:
run:
shell: bash -el {0}
steps:
- name: "Install jq 📦"
run: |
sudo apt update
sudo apt install -y jq
- name: "Checkout repository 🛎️"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Set up Miniconda 🐍"
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: conda-store-server/environment-dev.yaml
- name: "Install conda-store-server 📦"
run: python -m pip install conda-store-server/.
- name: "Run openapi.json generation script"
run: |
python docusaurus-docs/scripts/generate_openapi_json.py
jq . --sort-keys docusaurus-docs/static/openapi.json > docusaurus-docs/static/openapi.json.formatted
mv docusaurus-docs/static/openapi.json.formatted docusaurus-docs/static/openapi.json
- name: "Commit changes"
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Update REST API documentation (openapi.json)'
add: 'docusaurus-docs/static/openapi.json'
push: true