Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
project: ["./tsconfig.json"],
},
ignorePatterns: [
'.eslintrc.js', // https://stackoverflow.com/q/63118405
'jest.config.js',
'dist/**',
".eslintrc.js", // https://stackoverflow.com/q/63118405
"jest.config.js",
"dist/**",
],

rules: {
curly: ['error', 'multi-line'],
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/ban-types': 1,
'@typescript-eslint/no-unused-vars': [
'error',
curly: ["error", "multi-line"],
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/ban-types": 1,
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: '20'
cache: "yarn"
node-version: "20"
- run: yarn install
- run: yarn run build
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: '20'
cache: "yarn"
node-version: "20"
- run: yarn install
- run: yarn run lint
6 changes: 0 additions & 6 deletions .prettierrc.json

This file was deleted.

57 changes: 28 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
- uses: stainless-api/upload-openapi-spec-action@main
with:
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
input_path: 'path/to/my-company-openapi.json'
project_name: 'my-stainless-project'
commit_message: 'feat(api): my cool feature'
input_path: "path/to/my-company-openapi.json"
project_name: "my-stainless-project"
commit_message: "feat(api): my cool feature"
guess_config: true
```

Expand All @@ -62,16 +62,16 @@ Then, add the following to your `.gitlab-ci.yml` file:

```yaml
include:
- remote: 'https://raw.githubusercontent.com/stainless-api/upload-openapi-spec-action/main/.gitlab-ci.yml'
- remote: "https://raw.githubusercontent.com/stainless-api/upload-openapi-spec-action/main/.gitlab-ci.yml"

upload-openapi-spec:
extends: .upload-openapi-spec
variables:
STAINLESS_API_KEY: "$STAINLESS_API_KEY"
INPUT_PATH: '$CI_PROJECT_DIR/path/to/my-company-openapi.json'
PROJECT_NAME: 'my-stainless-project'
COMMIT_MESSAGE: 'feat(api): my cool feature'
GUESS_CONFIG: 'true'
INPUT_PATH: "$CI_PROJECT_DIR/path/to/my-company-openapi.json"
PROJECT_NAME: "my-stainless-project"
COMMIT_MESSAGE: "feat(api): my cool feature"
GUESS_CONFIG: "true"
# CONFIG_PATH: '$CI_PROJECT_DIR/path/to/my-company.stainless.yaml' # Optional
# OUTPUT_PATH: '$CI_PROJECT_DIR/path/to/output.json' # Optional
# BRANCH: 'main' # Optional
Expand All @@ -82,16 +82,16 @@ You can identify your Stainless project name on the [Stainless dashboard](https:
### Optional parameters

- `branch`: Specifies the branch to push files to. If you provide it, the project MUST have the [branches
feature](https://app.stainless.com/docs/guides/branches) enabled. By default, it is `main`.
feature](https://app.stainless.com/docs/guides/branches) enabled. By default, it is `main`.

- `commit_message`: Specifies the commit message that we will use for the commits generated for your SDKs as a result
of the API change (and which will subsequently appear in the Changelog). If you provide it, it MUST follow the
[Conventional Commits format](https://www.conventionalcommits.org/en/v1.0.0/). If you do not provide it, we will use a
default message.
of the API change (and which will subsequently appear in the Changelog). If you provide it, it MUST follow the
[Conventional Commits format](https://www.conventionalcommits.org/en/v1.0.0/). If you do not provide it, we will use a
default message.

- `guess_config`: When `true`, will update your Stainless config file based on the change you've made to your spec. This
does the same thing as selecting the "Generate missing endpoints" button in the Studio. By default, it is `false`. You
should not set this to `true` if you are passing a `config_path`.
does the same thing as selecting the "Generate missing endpoints" button in the Studio. By default, it is `false`. You
should not set this to `true` if you are passing a `config_path`.

## Usage with ReadMe for docs with example snippets

Expand Down Expand Up @@ -122,10 +122,10 @@ jobs:
- uses: stainless-api/upload-openapi-spec-action@main
with:
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
input_path: 'path/to/my-company-openapi.json'
output_path: 'path/to/my-company-openapi.documented.json'
project_name: 'my-stainless-project'
commit_message: 'feat(api): my cool feature'
input_path: "path/to/my-company-openapi.json"
output_path: "path/to/my-company-openapi.documented.json"
project_name: "my-stainless-project"
commit_message: "feat(api): my cool feature"
- uses: readmeio/rdme@v8
with:
rdme: openapi "path/to/my-company-openapi.documented.json" --key=${{ secrets.README_TOKEN }} --id=${{ secrets.README_DEFINITION_ID }}
Expand All @@ -140,7 +140,6 @@ This assumes the following secrets have been [uploaded to your GitHub Actions Se

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).


## Usage with Mintlify for docs with example snippets

If you use Mintlify's OpenAPI support for your API reference documentation,
Expand Down Expand Up @@ -174,21 +173,21 @@ jobs:
uses: stainless-api/upload-openapi-spec-action@main
with:
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
input_path: 'path/to/my-company-openapi.json'
output_path: 'path/to/my-company-openapi.documented.json'
project_name: 'my-stainless-project'
commit_message: 'feat(api): my cool feature'
input_path: "path/to/my-company-openapi.json"
output_path: "path/to/my-company-openapi.documented.json"
project_name: "my-stainless-project"
commit_message: "feat(api): my cool feature"
- name: Push documented spec to docs repo
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_file: 'path/to/my-company-openapi.documented.json'
destination_repo: '{DOCS_REPO_NAME}'
destination_folder: 'openapi-specs' # (optional) the folder in the destination repository to place the file in, if not the root directory
user_email: '{EMAIL}' # the email associated with the GH token
user_name: '{USERNAME}' # the username associated with the GH token
commit_message: 'Auto-updates from Stainless'
source_file: "path/to/my-company-openapi.documented.json"
destination_repo: "{DOCS_REPO_NAME}"
destination_folder: "openapi-specs" # (optional) the folder in the destination repository to place the file in, if not the root directory
user_email: "{EMAIL}" # the email associated with the GH token
user_name: "{USERNAME}" # the username associated with the GH token
commit_message: "Auto-updates from Stainless"
```

This assumes the following secrets have been [uploaded to your GitHub Actions Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets):
Expand Down
20 changes: 10 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ runs:
main: dist/index.js
inputs:
stainless_api_key:
description: 'Stainless API key.'
description: "Stainless API key."
required: true
input_path:
description: 'Path to the OpenAPI file.'
description: "Path to the OpenAPI file."
required: true
config_path:
description: 'Path to the Stainless config file.'
description: "Path to the Stainless config file."
required: false
output_path:
description: 'Output path for the decorated OpenAPI spec.'
description: "Output path for the decorated OpenAPI spec."
project_name:
description: 'Stainless project name.'
description: "Stainless project name."
required: true
commit_message:
description: 'Commit message to use in the commits in the SDK repo.'
description: "Commit message to use in the commits in the SDK repo."
required: false
guess_config:
description: 'If true, renegerate the endpoints in the Stainless config file.'
description: "If true, renegerate the endpoints in the Stainless config file."
required: false
default: 'false'
default: "false"
branch:
description: 'If true, renegerate the endpoints in the Stainless config file.'
description: "If true, renegerate the endpoints in the Stainless config file."
required: false
default: 'main'
default: "main"
Loading