Skip to content

Generate API

Generate API #15195

Workflow file for this run

name: Generate API
# TODO: eventually, we want this job to trigger based on perforce pushes
on:
schedule:
# this cron string runs every 2 hours
- cron: 0 0/2 * * *
workflow_dispatch:
jobs:
generate:
timeout-minutes: 10
runs-on: ubuntu-latest
concurrency:
group: generate-${{ github.head_ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.24.1
cache-dependency-path: ./otel-collector/beamable-collector/go.sum
- name: Run Setup
run: |
./setup.sh
- name: Install dotnet-format
run: dotnet tool install --global --version 5.1.250801 dotnet-format
- name: Build CLI
run: |
dotnet build ./cli/cli
- name: Generate API
run: |
dotnet run -f net10.0 --project ./cli/cli -- --host https://dev.api.beamable.com oapi generate --engine unity --conflict-strategy RenameUncommonConflicts --output ./cli/beamable.common/Runtime/OpenApi --cleaning-strategy RemoveCsFiles
- name: Install local packages
working-directory: ./
shell: bash
run: |
./setup.sh
./dev.sh
- name: Check for Changes
run: echo "any=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT
id: changes
- name: Check Status
run: git status
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
id: cpr
if: ${{ steps.changes.outputs.any == 'true' }}
with:
commit-message: syncing sdk from openapi
token: ${{secrets.CODEGEN_PR_GITHUB_TOKEN}}
title: Auto generate SDK from openAPI
body: The CLI autogenerated these changes to the SDK
branch: update-openapi
base: main
labels: bot,generated-api
delete-branch: true
add-paths: |
client/Packages/com.beamable/Common/Runtime/OpenApi
cli/beamable.common/Runtime/OpenApi
- name: Post to a Slack channel
if: ${{ steps.changes.outputs.any == 'true' && steps.cpr.outputs.pull-request-number }}
id: slack
uses: slackapi/slack-github-action@v1.21.0
with:
channel-id: C0409CMRKA9
slack-message: "Auto generated API has changed at ${{ steps.cpr.outputs.pull-request-url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}