Skip to content

More improvements to the SDK #508

More improvements to the SDK

More improvements to the SDK #508

Workflow file for this run

name: generate
permissions:
contents: write
on:
pull_request:
paths:
- 'justfile'
- .github/workflows/generate.yml
- 'spec.json'
- 'generate/generate.py'
workflow_dispatch:
inputs:
jobs:
format:
# Check if the PR is not from a fork
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
# required
app-id: ${{ secrets.GH_ORG_APP_ID }}
private-key: ${{ secrets.GH_ORG_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install just
uses: extractions/setup-just@v3
- name: Run generate
shell: bash
run: |
just generate
env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
- name: Check for modified files
id: git-check
run: echo "modified=$(if [[ -z $(git status --porcelain --untracked-files=no --ignore-submodules) ]]; then echo "false"; else echo "true"; fi)" >> "$GITHUB_OUTPUT"
- name: Commit changes, if any
if: steps.git-check.outputs.modified == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
git fetch origin
git add .
git commit -am "I have generated the latest API!" || true
git push origin ${{github.event.pull_request.head.ref }} || true
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}