mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
ci: combine sdk and format workflows into single generate workflow
This commit is contained in:
parent
632a0fe009
commit
1efdceaf10
2 changed files with 10 additions and 52 deletions
|
|
@ -1,4 +1,4 @@
|
|||
name: format
|
||||
name: generate
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -8,14 +8,10 @@ on:
|
|||
branches-ignore:
|
||||
- production
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: ["sdk"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
format:
|
||||
generate:
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
if: github.event.workflow_run.conclusion == 'success'
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
|
|
@ -29,9 +25,14 @@ jobs:
|
|||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
|
||||
- name: run
|
||||
- name: Generate SDK
|
||||
run: |
|
||||
./script/format.ts
|
||||
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 }}
|
||||
43
.github/workflows/sdk.yml
vendored
43
.github/workflows/sdk.yml
vendored
|
|
@ -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 }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue