From 1efdceaf1010c8db21d8b9ef2ec213eba7472dd5 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Tue, 9 Dec 2025 19:41:17 -0500 Subject: ci: combine sdk and format workflows into single generate workflow --- .github/workflows/format.yml | 37 ------------------------------------ .github/workflows/generate.yml | 38 +++++++++++++++++++++++++++++++++++++ .github/workflows/sdk.yml | 43 ------------------------------------------ 3 files changed, 38 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/format.yml create mode 100644 .github/workflows/generate.yml delete mode 100644 .github/workflows/sdk.yml (limited to '.github') diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 488d8c4a2..000000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: format - -on: - push: - branches-ignore: - - production - pull_request: - branches-ignore: - - production - workflow_dispatch: - workflow_run: - workflows: ["sdk"] - types: - - completed -jobs: - format: - runs-on: blacksmith-4vcpu-ubuntu-2404 - if: github.event.workflow_run.conclusion == 'success' - 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: run - run: | - ./script/format.ts - env: - CI: true - PUSH_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }} diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml new file mode 100644 index 000000000..326090f7a --- /dev/null +++ b/.github/workflows/generate.yml @@ -0,0 +1,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 }} diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml deleted file mode 100644 index 10d02a1df..000000000 --- a/.github/workflows/sdk.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: sdk - -on: - push: - branches-ignore: - - production - pull_request: - branches-ignore: - - production - workflow_dispatch: -jobs: - format: - 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: run - 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 - if [ -z "$(git status --porcelain)" ]; then - echo "No changes to commit" - exit 0 - fi - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add -A - git commit -m "chore: regen sdk" - git push origin HEAD:${PUSH_BRANCH} --no-verify - env: - CI: true - PUSH_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }} -- cgit v1.2.3