-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (50 loc) · 1.81 KB
/
generate_openapi.yml
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
53
54
55
56
57
58
59
60
61
name: Generate OpenAPI JSON
on:
workflow_dispatch:
jobs:
generate-openapi:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install and cache poetry
run: |
make -f .config/Makefile install-poetry
if: steps.cache.outputs.cache-hit != 'true'
# - name: Set GITHUB_ENV
# run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV
- name: Cache poetry dependencies
id: cache
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-
- name: Install dependencies with poetry
run: poetry install
env:
POETRY_VIRTUALENVS_IN_PROJECT: true
if: steps.cache.outputs.cache-hit != 'true'
- name: Install jq
run: sudo apt-get install -y jq
- name: Run OpenAPI generation script
env:
PYTHONPATH: ${{ github.workspace }}/src # Set the PYTHONPATH
run: |
# Ensure the script is executable
chmod +x bin/generate_openapi.sh
# Run the script within the Poetry environment
poetry run ./bin/generate_openapi.sh
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add docs/schema/openapi.json
git commit -m "Update OpenAPI JSON file"
git push
env:
FITNESS_TRACKER_GITHUB_ACCESS_TOKEN: ${{ secrets.FITNESS_TRACKER_GITHUB_ACCESS_TOKEN }}