generate-sdk #11
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
name: Generate Ruby Backend SDK | |
on: | |
repository_dispatch: | |
types: [generate-sdk] | |
workflow_dispatch: | |
inputs: | |
actor: | |
type: string | |
description: "To username of the actor that triggered the workflow" | |
required: false | |
id: | |
type: string | |
description: "The ID of the pull request" | |
required: false | |
url: | |
type: string | |
description: "The URL of the pull request" | |
required: false | |
title: | |
type: string | |
description: "The title of the pull request" | |
required: false | |
description: | |
type: string | |
description: "The description of the pull request" | |
required: false | |
env: | |
DEFAULT_ACTOR: "tmilewski" | |
DEFAULT_TITLE: "Generate Ruby Backend SDK" | |
DEFAULT_DESCRIPTION: "Generated independently of an OpenAPI spec change" | |
DEFAULT_URL: "https://github.com/clerk/openapi-specs" | |
jobs: | |
generate-sdk: | |
runs-on: ubuntu-latest | |
name: Generate | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Move root to ./out | |
run: | | |
rm -rf ./out | |
mkdir ./out | |
shopt -s extglob | |
shopt -s dotglob | |
mv !(out) ./out | |
- name: Generate new client | |
uses: openapi-generators/openapitools-generator-action@v1 | |
with: | |
generator: ruby | |
command-args: -o out --api-name-suffix=' ' | |
config-file: out/sdk-generator-config.json | |
# openapi-file: out/resources/oas/bapi-2024-10-01.yml | |
openapi-url: https://raw.githubusercontent.com/clerk/openapi-specs/refs/heads/main/bapi/2024-10-01.yml | |
template-dir: out/resources/templates | |
- name: Move generated files to root | |
run: | | |
shopt -s extglob | |
shopt -s dotglob | |
mv -fv ./out/* . | |
rm -rv ./out | |
ls -la . | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
# Skips local testing with `act` | |
if: ${{ github.actor != 'nektos/act' }} | |
with: | |
title: ${{ github.event.client_payload.title || inputs.title || env.DEFAULT_TITLE }} | |
body: "${{ github.event.client_payload.description || inputs.description || env.DEFAULT_DESCRIPTION }}\n\n${{ github.event.client_payload.url || inputs.url || env.DEFAULT_URL }}" | |
branch: "generate-sdk" | |
commit-message: "Generate Ruby Backend SDK" | |
branch-suffix: "timestamp" | |
assignees: ${{ github.event.client_payload.actor || inputs.actor || github.actor || env.DEFAULT_ACTOR }} | |
reviewers: ${{ env.DEFAULT_ACTOR }} |