|
| 1 | +name: Stainless SDK Builds |
| 2 | + |
| 3 | +run-name: Build Stainless SDKs |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + types: |
| 8 | + - opened |
| 9 | + - synchronize |
| 10 | + - reopened |
| 11 | + - closed |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +env: |
| 18 | + # Stainless organization name. |
| 19 | + STAINLESS_ORG: llamastack |
| 20 | + |
| 21 | + # Stainless project name. |
| 22 | + STAINLESS_PROJECT: llama-stack-client |
| 23 | + |
| 24 | + # Path to your OpenAPI spec. |
| 25 | + OAS_PATH: ./docs/static/llama-stack-spec.yaml |
| 26 | + |
| 27 | + # Path to your Stainless config. Optional; only provide this if you prefer |
| 28 | + # to maintain the ground truth Stainless config in your own repo. |
| 29 | + CONFIG_PATH: ./docs/static/stainless-config.yaml |
| 30 | + |
| 31 | + # When to fail the job based on build conclusion. |
| 32 | + # Options: "never" | "note" | "warning" | "error" | "fatal". |
| 33 | + FAIL_ON: error |
| 34 | + |
| 35 | +jobs: |
| 36 | + preview: |
| 37 | + if: github.event.action != 'closed' |
| 38 | + runs-on: ubuntu-latest |
| 39 | + permissions: |
| 40 | + contents: read |
| 41 | + pull-requests: write |
| 42 | + steps: |
| 43 | + - name: Checkout repository |
| 44 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 45 | + with: |
| 46 | + fetch-depth: 2 |
| 47 | + |
| 48 | + - name: Run preview builds |
| 49 | + uses: stainless-api/upload-openapi-spec-action/preview@b741c27bc604e5c130b92ed4056b07aee783aa04 # v1.5.4 |
| 50 | + with: |
| 51 | + stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} |
| 52 | + org: ${{ env.STAINLESS_ORG }} |
| 53 | + project: ${{ env.STAINLESS_PROJECT }} |
| 54 | + oas_path: ${{ env.OAS_PATH }} |
| 55 | + config_path: ${{ env.CONFIG_PATH }} |
| 56 | + fail_on: ${{ env.FAIL_ON }} |
| 57 | + make_comment: true |
| 58 | + commit_message: "feat(api): preview build for PR #${{ inputs.pr_number }}" |
| 59 | + |
| 60 | + merge: |
| 61 | + if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true |
| 62 | + runs-on: ubuntu-latest |
| 63 | + permissions: |
| 64 | + contents: read |
| 65 | + pull-requests: write |
| 66 | + steps: |
| 67 | + - name: Checkout repository |
| 68 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 69 | + with: |
| 70 | + fetch-depth: 2 |
| 71 | + |
| 72 | + # Note that this only merges in changes that happened on the last build on |
| 73 | + # preview/${{ github.head_ref }}. It's possible that there are OAS/config |
| 74 | + # changes that haven't been built, if the preview-sdk job didn't finish |
| 75 | + # before this step starts. In theory we want to wait for all builds |
| 76 | + # against preview/${{ github.head_ref }} to complete, but assuming that |
| 77 | + # the preview-sdk job happens before the PR merge, it should be fine. |
| 78 | + - name: Run merge build |
| 79 | + uses: stainless-api/upload-openapi-spec-action/merge@b741c27bc604e5c130b92ed4056b07aee783aa04 # v1.5.4 |
| 80 | + with: |
| 81 | + stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} |
| 82 | + org: ${{ env.STAINLESS_ORG }} |
| 83 | + project: ${{ env.STAINLESS_PROJECT }} |
| 84 | + oas_path: ${{ env.OAS_PATH }} |
| 85 | + config_path: ${{ env.CONFIG_PATH }} |
| 86 | + fail_on: ${{ env.FAIL_ON }} |
0 commit comments