Generate Python SDK #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow generates the Python SDK from the Permify OpenAPI specification | |
# It fetches the latest openapi.json from the Permify repository and runs the SDK generation script | |
name: Generate Python SDK | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'generator/**' | |
- '.github/workflows/generator.yml' | |
jobs: | |
generate: | |
name: Generate SDK from OpenAPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download OpenAPI spec from Permify repository | |
run: | | |
echo "Downloading latest OpenAPI specification from Permify repository..." | |
curl -L -o generator/openapi.json https://raw.githubusercontent.com/Permify/permify/master/docs/api-reference/openapiv2/apidocs.swagger.json | |
- name: Check if OpenAPI spec has changed | |
id: check_changes | |
run: | | |
if git diff --quiet generator/openapi.json; then | |
echo "No changes in OpenAPI specification" | |
echo "changed=false" >> $GITHUB_OUTPUT | |
else | |
echo "OpenAPI specification has changed" | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Make generate script executable | |
if: steps.check_changes.outputs.changed == 'true' | |
run: chmod +x generator/generate-sdk.sh | |
- name: Setup Java | |
if: steps.check_changes.outputs.changed == 'true' | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Generate Python SDK | |
if: steps.check_changes.outputs.changed == 'true' | |
run: | | |
cd generator | |
./generate-sdk.sh | |
- name: Configure Git | |
if: steps.check_changes.outputs.changed == 'true' | |
run: | | |
git config --global user.name "Permify GitHub Actions" | |
git config --global user.email "<>" | |
- name: Create Pull Request | |
if: steps.check_changes.outputs.changed == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
commit-message: "chore: update Python SDK from latest OpenAPI specification" | |
title: "chore: update Python SDK from latest OpenAPI specification" | |
body: | | |
This PR updates the Python SDK based on the latest OpenAPI specification from the Permify repository. | |
## Changes | |
- Updated OpenAPI specification | |
- Regenerated Python SDK code | |
- Updated documentation | |
- Updated package configuration (setup.py, pyproject.toml) | |
This is an automated update generated by the SDK generator workflow. | |
branch: update-sdk-from-openapi | |
delete-branch: true | |