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
with the name `STAINLESS_API_KEY`. You can do this with the GitHub CLI via:
11
+
[Install the Stainless GitHub App](https://www.stainless.com/docs/guides/publish/#install-the-stainless-github-app) and link it to your Stainless organization. The action will authenticate using GitHub OIDC—no API keys needed.
15
12
16
-
```bash
17
-
gh secret set STAINLESS_API_KEY
18
-
```
13
+
**GitLab CI:** OIDC isn't yet supported. Set the `STAINLESS_API_KEY` environment variable instead. See the template files in `build/gitlab-ci.yml`, `merge/gitlab-ci.yml`, and `preview/gitlab-ci.yml`.
14
+
15
+
**API keys:** If you'd rather use an API key, see [pull_request_api_key.yml](./examples/pull_request_api_key.yml) and add a `STAINLESS_API_KEY` secret to your repo.
19
16
20
-
In the same repository, add a new workflow file:
17
+
## Usage
18
+
19
+
Add a workflow file to the repository that contains your OpenAPI spec:
@@ -99,53 +98,31 @@ For more examples of usage, including push-based workflows, using code samples,
99
98
integration with docs platforms, and testing preview builds, see the [examples
100
99
directory](./examples).
101
100
102
-
## Actions
103
-
104
-
This repository provides four GitHub actions.
101
+
## Security
105
102
106
-
- `stainless-api/upload-openapi-spec-action/build`: Build SDKs for a Stainless
107
-
project. For information about the input parameters, see the [action definition](./build/action.yml).
103
+
If your GitHub repository is public, require approval for workflows from fork PRs to prevent untrusted contributors from accessing OIDC tokens or secrets.
108
104
109
-
- `stainless-api/upload-openapi-spec-action/preview`: Preview changes to SDKs
110
-
introduced by a pull request. For information about the input parameters, see
111
-
the [action definition](./preview/action.yml).
105
+
Go to **Settings** → **Actions** → **General**, then under "Fork pull request workflows from outside collaborators", select **"Require approval for all outside collaborators"**.
112
106
113
-
- `stainless-api/upload-openapi-spec-action/merge`: Merge changes to SDKs from
114
-
a pull request. For information about the input parameters, see the [action
115
-
definition](./merge/action.yml).
107
+
See [GitHub's docs](https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks) for more details.
116
108
117
-
- `stainless-api/upload-openapi-spec-action/checkout-pr-ref`: Checkout the base
118
-
or head commit for previewing a pull request's changes, saving changes to the
119
-
config when needed. For information about the input parameters, see the [action
120
-
definition](./checkout-pr-ref/action.yml).
109
+
## Actions reference
121
110
122
-
All except for the last action are also usable in GitLab CI.
111
+
This repository provides four GitHub actions:
123
112
124
-
### Testing preview builds
113
+
- `stainless-api/upload-openapi-spec-action/build`- Build SDKs for a Stainless project. See the [action definition](./build/action.yml) for input parameters.
125
114
126
-
The `preview` and `merge` actions output an `install_url` for each SDK language,
127
-
which you can use to install and test SDK builds directly from the Stainless
128
-
package server. This is useful for running integration tests against preview
129
-
builds before merging, or for verifying merged builds. See the
130
-
[SDK usage example](./examples/pull_request_sdk_usage.yml) for a complete
131
-
workflow.
115
+
- `stainless-api/upload-openapi-spec-action/preview`- Preview SDK changes from a pull request. See the [action definition](./preview/action.yml) for input parameters.
132
116
133
-
### Workflow permissions
117
+
- `stainless-api/upload-openapi-spec-action/merge`- Merge SDK changes from a pull request. See the [action definition](./merge/action.yml) for input parameters.
- `stainless-api/upload-openapi-spec-action/checkout-pr-ref`- Checkout the base or head commit for previewing changes. See the [action definition](./checkout-pr-ref/action.yml) for input parameters.
137
120
138
-
- The `preview` and `merge` actions have a `make_comment` input, which, if set,
139
-
will comment on the pull request with the build results. This is set to true by
140
-
default. The actions use the `github_token` input to make a comment, and the
141
-
comment must have the `pull-requests: write` permission.
121
+
All except `checkout-pr-ref` work in GitLab CI.
142
122
143
-
- The `preview` and `checkout-pr-ref` actions rely on being in a Git repository
144
-
that can fetch from the remote to determine base revisions. This will be the
145
-
case if you use the [`actions/checkout`](https://github.com/actions/checkout)
146
-
GitHub action beforehand. That action needs the `contents: read` permission.
123
+
The `preview` and `merge` actions output an `install_url` for each SDK language. You can use this to test builds directly from the Stainless package server before merging. See the [SDK usage example](./examples/pull_request_sdk_usage.yml).
147
124
148
-
### Versioning policy
125
+
## Versioning
149
126
150
127
These actions use [semantic versioning](https://semver.org/), and you can pin
151
128
your action to a major (`v1`), minor (`v1.0`), or patch (`v1.0.0`) version.
0 commit comments