|
1 | | -name: Stainless SDK Builds |
| 1 | +name: Build SDKs for pull request |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | pull_request: |
|
7 | 7 | - synchronize |
8 | 8 | - reopened |
9 | 9 | - closed |
10 | | - paths: |
11 | | - - "packages/server/openapi.v3.yaml" |
12 | | - - ".github/workflows/stainless.yml" |
13 | 10 |
|
14 | 11 | concurrency: |
15 | | - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 12 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} |
16 | 13 | cancel-in-progress: true |
17 | 14 |
|
18 | 15 | env: |
19 | | - # Configure these as GitHub Actions Variables (Settings → Secrets and variables → Actions → Variables) |
20 | 16 | STAINLESS_ORG: ${{ vars.STAINLESS_ORG }} |
21 | 17 | STAINLESS_PROJECT: ${{ vars.STAINLESS_PROJECT }} |
22 | 18 | OAS_PATH: packages/server/openapi.v3.yaml |
23 | 19 |
|
24 | 20 | jobs: |
25 | 21 | preview: |
26 | | - if: github.event_name != 'pull_request' || github.event.action != 'closed' |
| 22 | + if: github.event.action != 'closed' |
27 | 23 | runs-on: ubuntu-latest |
28 | 24 | permissions: |
29 | 25 | contents: read |
30 | 26 | pull-requests: write |
31 | | - id-token: write |
32 | 27 | steps: |
33 | 28 | - name: Checkout repository |
34 | 29 | uses: actions/checkout@v4 |
35 | 30 | with: |
36 | 31 | fetch-depth: 2 |
37 | 32 |
|
38 | | - - name: Validate Stainless configuration |
39 | | - shell: bash |
40 | | - run: | |
41 | | - set -euo pipefail |
42 | | - if [[ -z "${STAINLESS_ORG}" ]]; then |
43 | | - echo "Missing STAINLESS_ORG. Set the Actions variable STAINLESS_ORG." |
44 | | - exit 1 |
45 | | - fi |
46 | | - if [[ -z "${STAINLESS_PROJECT}" ]]; then |
47 | | - echo "Missing STAINLESS_PROJECT. Set the Actions variable STAINLESS_PROJECT." |
48 | | - exit 1 |
49 | | - fi |
50 | | - if [[ ! -f "${OAS_PATH}" ]]; then |
51 | | - echo "OpenAPI spec not found at ${OAS_PATH}" |
52 | | - exit 1 |
53 | | - fi |
54 | | -
|
55 | 33 | - name: Run preview builds |
56 | 34 | uses: stainless-api/upload-openapi-spec-action/preview@v1 |
57 | 35 | with: |
| 36 | + stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} |
58 | 37 | org: ${{ env.STAINLESS_ORG }} |
59 | 38 | project: ${{ env.STAINLESS_PROJECT }} |
60 | 39 | oas_path: ${{ env.OAS_PATH }} |
61 | 40 |
|
62 | 41 | merge: |
63 | | - if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true |
| 42 | + if: github.event.action == 'closed' && github.event.pull_request.merged == true |
64 | 43 | runs-on: ubuntu-latest |
65 | 44 | permissions: |
66 | 45 | contents: read |
67 | 46 | pull-requests: write |
68 | | - id-token: write |
69 | 47 | steps: |
70 | 48 | - name: Checkout repository |
71 | 49 | uses: actions/checkout@v4 |
72 | 50 | with: |
73 | 51 | fetch-depth: 2 |
74 | | - |
75 | | - - name: Validate Stainless configuration |
76 | | - shell: bash |
77 | | - run: | |
78 | | - set -euo pipefail |
79 | | - if [[ -z "${STAINLESS_ORG}" ]]; then |
80 | | - echo "Missing STAINLESS_ORG. Set the Actions variable STAINLESS_ORG." |
81 | | - exit 1 |
82 | | - fi |
83 | | - if [[ -z "${STAINLESS_PROJECT}" ]]; then |
84 | | - echo "Missing STAINLESS_PROJECT. Set the Actions variable STAINLESS_PROJECT." |
85 | | - exit 1 |
86 | | - fi |
87 | | - if [[ ! -f "${OAS_PATH}" ]]; then |
88 | | - echo "OpenAPI spec not found at ${OAS_PATH}" |
89 | | - exit 1 |
90 | | - fi |
91 | | -
|
92 | 52 | - name: Run merge build |
93 | 53 | uses: stainless-api/upload-openapi-spec-action/merge@v1 |
94 | 54 | with: |
| 55 | + stainless_api_key: ${{ secrets.STAINLESS_API_KEY }} |
95 | 56 | org: ${{ env.STAINLESS_ORG }} |
96 | 57 | project: ${{ env.STAINLESS_PROJECT }} |
97 | 58 | oas_path: ${{ env.OAS_PATH }} |
0 commit comments