You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A GitHub Action for pushing your OpenAPI spec to [Stainless](https://stainless.com/) to trigger regeneration of your SDKs.
10
+
A CI component for pushing your OpenAPI spec to [Stainless](https://stainless.com/) to trigger regeneration of your SDKs. Supports both GitHub Actions and GitLab CI.
11
11
12
12
Note that there is currently a manual step in between this action and automatic creation of your PR's,
13
13
and more manual steps before they are merged and released.
@@ -18,7 +18,11 @@ so that your API reference documentation can show examples of making each reques
18
18
19
19
## Example usage
20
20
21
-
First, obtain an API Key from your Stainless dashboard, and [add it to your GitHub Actions secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) as `STAINLESS_API_KEY`:
21
+
First, obtain an API Key from your Stainless dashboard.
22
+
23
+
### GitHub Actions
24
+
25
+
For GitHub Actions, [add the API key to your repository secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) as `STAINLESS_API_KEY`:
22
26
23
27
```
24
28
gh secret set STAINLESS_API_KEY
@@ -50,6 +54,28 @@ jobs:
50
54
51
55
You can optionally add `config_path: 'path/to/my-company.stainless.yaml'` to the `with:` block if you'd like to send us updates to your Stainless config.
52
56
57
+
### GitLab CI
58
+
59
+
For GitLab CI, add the API key to your [GitLab CI/CD variables](https://docs.gitlab.com/ee/ci/variables/#add-a-cicd-variable-to-a-project) as `STAINLESS_API_KEY`.
60
+
61
+
Then, add the following to your `.gitlab-ci.yml` file:
You can identify your Stainless project name on the [Stainless dashboard](https://app.stainless.com/).
54
80
55
81
### Optional parameters
@@ -75,7 +101,9 @@ openapi:
75
101
code_samples: readme
76
102
```
77
103
78
-
Then configure your GitHub Action to upload the Stainless-enhanced OpenAPI spec to ReadMe:
104
+
### GitHub Actions with ReadMe
105
+
106
+
Configure your GitHub Action to upload the Stainless-enhanced OpenAPI spec to ReadMe:
79
107
80
108
```yaml
81
109
name: Upload OpenAPI spec to Stainless and ReadMe
@@ -111,6 +139,46 @@ This assumes the following secrets have been [uploaded to your GitHub Actions Se
111
139
112
140
Remember to set the `readmeio/rdme` ref version to the latest stable available (`v8`, as of this writing). You can verify the latest version of ReadMe's GitHub Action [here](https://github.com/marketplace/actions/rdme-sync-to-readme).
113
141
142
+
### GitLab CI with ReadMe
143
+
144
+
Configure your GitLab CI pipeline to upload the Stainless-enhanced OpenAPI spec to ReadMe:
This assumes the following variables have been added to your GitLab CI/CD Variables:
177
+
178
+
- `STAINLESS_API_KEY`: Your Stainless API key.
179
+
- `README_TOKEN`: Your ReadMe API key.
180
+
- `README_DEFINITION_ID`: Your ReadMe API definition ID.
181
+
114
182
## Usage with Mintlify for docs with example snippets
115
183
116
184
If you use Mintlify's OpenAPI support for your API reference documentation,
@@ -121,7 +189,11 @@ openapi:
121
189
code_samples: mintlify
122
190
```
123
191
124
-
Mintlify can generate your docs based on the OpenAPI spec in your docs repo if it is [configured to do so](https://mintlify.com/docs/api-playground/openapi/setup#in-the-repo). To integrate Stainless, you can modify the GitHub Action that uploads your OpenAPI spec to Stainless such that it then pushes the Stainless-enhanced OpenAPI spec into your docs repo:
192
+
Mintlify can generate your docs based on the OpenAPI spec in your docs repo if it is [configured to do so](https://mintlify.com/docs/api-playground/openapi/setup#in-the-repo).
193
+
194
+
### GitHub Actions with Mintlify
195
+
196
+
To integrate Stainless with your GitHub Actions workflow:
125
197
126
198
```yaml
127
199
name: Upload OpenAPI spec to Stainless and (Mintlify) docs repo
@@ -161,3 +233,56 @@ This assumes the following secrets have been [uploaded to your GitHub Actions Se
161
233
162
234
- `secrets.STAINLESS_API_KEY`: Your Stainless API key.
163
235
- `secrets.API_TOKEN_GITHUB`: A GitHub [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with permissions to push to your docs repo.
236
+
237
+
### GitLab CI with Mintlify
238
+
239
+
To integrate Stainless with your GitLab CI pipeline:
Copy file name to clipboardExpand all lines: action.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
name: Stainless — Upload OpenAPI specification
2
-
description: Upload your OpenAPI spec to update your Stainless SDKs (and, if configured, add example snippets to your API docs)
2
+
description: Upload your OpenAPI spec to update your Stainless SDKs (and, if configured, add example snippets to your API docs). Works with GitHub Actions and GitLab CI.
0 commit comments