Generate Java SDK #15
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 Java SDK from the Permify OpenAPI specification | |
| # It fetches the latest openapi.json from the Permify repository and runs the SDK generation script | |
| name: Generate Java 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: Generate Java 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 Java SDK from latest OpenAPI specification" | |
| title: "chore: update Java SDK from latest OpenAPI specification" | |
| body: | | |
| This PR updates the Java SDK based on the latest OpenAPI specification from the Permify repository. | |
| ## Changes | |
| - Updated OpenAPI specification | |
| - Regenerated Java SDK code | |
| - Updated documentation | |
| This is an automated update generated by the SDK generator workflow. | |
| branch: update-sdk-from-openapi | |
| delete-branch: true | |