Skip to content

Commit 155466d

Browse files
authored
ci: add workflow_dispatch path to force-upload OpenAPI spec from main (#5647)
## Summary - Adds a `force-upload` job in `stainless-builds.yml` that runs on `workflow_dispatch` when `pr_number` is empty. It checks out `main` and uses `upload-openapi-spec-action/build` to unconditionally push the current OpenAPI spec and config to the Stainless project's `main` branch. - Makes the `pr_number` input optional (was `required: true`). - Gates the existing PR pipeline (`compute-branch` and downstream `preview` / `merge` / `run-integration-tests`) so it skips on the force-upload path. ## Why The `upload-openapi-spec-action/merge` action diffs base→head and skips when the OAS/config files didn't change in the PR. After out-of-band Stainless changes (e.g. the recent org/project rename in #5634), the spec on Stainless can drift from what's in the repo with no way to resync short of editing the spec file. This adds a manual lever to re-push the current spec without faking a content change. ## Test plan - [ ] After merge, run the workflow manually from the Actions tab with no `pr_number`. Confirm the `force-upload` job runs, posts the spec to `llamastack/llama-stack-client` on Stainless, and the other jobs are skipped. - [ ] Open a regular PR touching `client-sdks/stainless/**` and confirm the existing preview/merge/integration-tests pipeline still runs as before.
1 parent bfdae03 commit 155466d

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

.github/workflows/stainless-builds.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ on:
3030
workflow_dispatch:
3131
inputs:
3232
pr_number:
33-
description: 'PR number to run Stainless build for'
34-
required: true
33+
description: 'PR number to run Stainless build for. Leave empty to force-upload the current OpenAPI spec from main.'
34+
required: false
3535
type: number
3636
sdk_install_url:
3737
description: 'Python SDK install URL (optional, for testing specific builds)'
@@ -65,7 +65,34 @@ env:
6565
# Stainless organization dashboard
6666

6767
jobs:
68+
force-upload:
69+
# Push the OpenAPI spec from main to Stainless without a PR. Triggered
70+
# manually via workflow_dispatch with no pr_number. Skips preview and
71+
# integration tests; just uploads the spec on the main branch.
72+
if: github.event_name == 'workflow_dispatch' && inputs.pr_number == ''
73+
runs-on: ubuntu-latest
74+
permissions:
75+
contents: read
76+
steps:
77+
- name: Checkout main
78+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
79+
with:
80+
ref: main
81+
82+
- name: Upload OpenAPI spec to Stainless
83+
uses: stainless-api/upload-openapi-spec-action/build@020053e7fbf853281174bd3029eb3bfa7a54c039 # 1.13.0
84+
with:
85+
stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
86+
org: ${{ env.STAINLESS_ORG }}
87+
project: ${{ env.STAINLESS_PROJECT }}
88+
oas_path: ${{ env.OAS_PATH }}
89+
config_path: ${{ env.CONFIG_PATH }}
90+
fail_on: ${{ env.FAIL_ON }}
91+
branch: main
92+
make_comment: false
93+
6894
compute-branch:
95+
if: github.event_name == 'pull_request_target' || (github.event_name == 'workflow_dispatch' && inputs.pr_number != '')
6996
runs-on: ubuntu-latest
7097
outputs:
7198
preview_branch: ${{ steps.compute.outputs.preview_branch }}

0 commit comments

Comments
 (0)