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