Skip to content

Commit

Permalink
add python
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsy-opal committed Nov 26, 2024
1 parent c1f691f commit cd0a733
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/autogen-remote-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,35 @@ on: [push, pull_request]
jobs:
update-sdk:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- name: Checkout repository
run: |
git clone https://github.com/${{ github.repository }} repo
cd repo
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install OpenAPI Generator CLI
run: npm install @openapitools/openapi-generator-cli -g
- name: Install dependencies
run: |
cd repo
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Pull and generate SDK
run: |
cd repo
make gen-openapi-remote
make gen-openapi-remote-for-ci
- name: Check for changes
run: |
cd repo
Expand Down Expand Up @@ -49,7 +67,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_TITLE="Auto-update SDK on $(date +'%Y-%m-%d')"
PR_BODY="This pull request was automatically created by GitHub Actions to update the SDK."
PR_BODY="This pull request was automatically created by GitHub Actions to update the SDK with the latest remote OpenAPI specification."
curl -H "Authorization: token $GITHUB_TOKEN" \
-X POST \
-H "Content-Type: application/json" \
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ SHELL:=/bin/bash
PYTHON_POST_PROCESS_FILE=python -m black

OPENAPI_GEN=openapi-generator generate --enable-post-process-file -i api/openapi.yaml -g python -o . -c config.json -t .openapi-generator/templates
OPENAPI_GEN_CI=openapi-generator-cli generate --enable-post-process-file -i api/openapi.yaml -g python -o . -c config.json -t .openapi-generator/templates

gen-openapi:
$(OPENAPI_GEN)
gen-openapi-remote:
curl https://app.opal.dev/openapi.yaml > api/openapi.yaml
$(OPENAPI_GEN)
$(OPENAPI_GEN)
gen-openapi-remote-for-ci:
curl https://app.opal.dev/openapi.yaml > api/openapi.yaml
$(OPENAPI_GEN_CI)

0 comments on commit cd0a733

Please sign in to comment.