summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/generate.yml
blob: 326090f7a249da8d7314862c629b6adaeaf2eb32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: generate

on:
  push:
    branches-ignore:
      - production
  pull_request:
    branches-ignore:
      - production
  workflow_dispatch:

jobs:
  generate:
    runs-on: blacksmith-4vcpu-ubuntu-2404
    permissions:
      contents: write
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
          ref: ${{ github.event.pull_request.head.ref || github.ref_name }}

      - name: Setup Bun
        uses: ./.github/actions/setup-bun

      - name: Generate SDK
        run: |
          bun ./packages/sdk/js/script/build.ts
          (cd packages/opencode && bun dev generate > ../sdk/openapi.json)
          bun x prettier --write packages/sdk/openapi.json

      - name: Format
        run: ./script/format.ts
        env:
          CI: true
          PUSH_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }}