Workflow file for this run
This file contains 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
name: Generate Client SDKs from OpenAPI | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.SDK_GH_TOKEN }} | |
ORG_NAME: Permify | |
SWAGGER_PATH: docs/api-reference/openapiv2/apidocs.swagger.json | |
strategy: | |
matrix: | |
language: [python] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Generate Python Client | |
uses: openapi-generators/openapitools-generator-action@e2367b13d18174ee00d5c2894492883965808c8f # v1 | |
with: | |
generator: ${{ matrix.language }} | |
openapi-file: ${SWAGGER_PATH} | |
command-args: -o permify-client --git-user-id ${ORG_NAME} --git-repo-id permify-${{ matrix.language }} --package-name permify --global-property apis,models | |
- name: Push SDK to GitHub | |
run: | | |
git config --global user.name 'GitHub Actions Bot' | |
git config --global user.email '<>' | |
git clone https://${GITHUB_TOKEN}@github.com/${ORG_NAME}/permify-${{ matrix.language }}.git temp | |
cp -r permify-client/* temp/ | |
cd temp | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Update ${{ matrix.language }} SDK from OpenAPI changes" | |
git push https://${GITHUB_TOKEN}@github.com/${ORG_NAME}/permify-${{ matrix.language }}.git main --force | |
rm -rf permify-client |