-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathpull_request_sdk_usage.yml
More file actions
79 lines (66 loc) · 2.34 KB
/
pull_request_sdk_usage.yml
File metadata and controls
79 lines (66 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Build Stainless SDKs (SDK usage)
on:
pull_request:
types: [opened, synchronize, reopened]
push:
# Set this to the branch of the repository that the `main` Stainless branch
# of your project gets its OpenAPI spec from. This is usually the default
# branch of your repository.
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Stainless organization name.
STAINLESS_ORG: YOUR_ORG
# Stainless project name.
STAINLESS_PROJECT: YOUR_PROJECT
# Path to your OpenAPI spec.
OAS_PATH: YOUR_OAS_PATH
# Path to your Stainless config. Optional; only provide this if you prefer
# to maintain the ground truth Stainless config in your own repo.
CONFIG_PATH: YOUR_CONFIG_PATH
# When to fail the job based on build conclusion.
# Options: "never" | "note" | "warning" | "error" | "fatal".
FAIL_ON: error
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Run build
id: build
uses: stainless-api/upload-openapi-spec-action/build@v1
with:
org: ${{ env.STAINLESS_ORG }}
project: ${{ env.STAINLESS_PROJECT }}
oas_path: ${{ env.OAS_PATH }}
config_path: ${{ env.CONFIG_PATH }}
fail_on: ${{ env.FAIL_ON }}
# Example: Extract install_url and test the SDK build
# This demonstrates how to use the install_url output to run integration tests
# against the build.
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install and test preview SDK
run: |
# Extract the install_url for the TypeScript SDK from the outcomes
INSTALL_URL=$(echo '${{ steps.build.outputs.outcomes }}' | jq -r '.typescript.install_url // empty')
if [ -n "$INSTALL_URL" ]; then
echo "Installing preview SDK from: $INSTALL_URL"
npm install "$INSTALL_URL"
# Run your integration tests here
# npm test
# or other validation commands
echo "Preview SDK installed successfully!"
else
echo "No install_url found for TypeScript SDK"
fi