sdk.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. name: sdk
  2. on:
  3. push:
  4. branches-ignore:
  5. - production
  6. pull_request:
  7. branches-ignore:
  8. - production
  9. workflow_dispatch:
  10. jobs:
  11. format:
  12. runs-on: blacksmith-4vcpu-ubuntu-2404
  13. permissions:
  14. contents: write
  15. steps:
  16. - name: Checkout repository
  17. uses: actions/checkout@v4
  18. with:
  19. token: ${{ secrets.GITHUB_TOKEN }}
  20. repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
  21. ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
  22. - name: Setup Bun
  23. uses: ./.github/actions/setup-bun
  24. - name: run
  25. run: |
  26. bun ./packages/sdk/js/script/build.ts
  27. (cd packages/opencode && bun dev generate > ../sdk/openapi.json)
  28. bun x prettier --write packages/sdk/js/src/openapi.ts
  29. if [ -z "$(git status --porcelain)" ]; then
  30. echo "No changes to commit"
  31. exit 0
  32. fi
  33. git config --local user.email "[email protected]"
  34. git config --local user.name "GitHub Action"
  35. git add -A
  36. git commit -m "chore: regen sdk"
  37. git push origin HEAD:${PUSH_BRANCH} --no-verify
  38. env:
  39. CI: true
  40. PUSH_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }}