Skip to content

Add publish-v1-specs workflow - #195

Open
zacchua-stripe wants to merge 3 commits into
masterfrom
zacchua/publish-private-preview-workflow
Open

Add publish-v1-specs workflow#195
zacchua-stripe wants to merge 3 commits into
masterfrom
zacchua/publish-private-preview-workflow

Conversation

@zacchua-stripe

@zacchua-stripe zacchua-stripe commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

What

Follow up to https://docs.google.com/document/d/1RH_6VhWlPGnBX17bwu1WWXCaBjDO3CtKqg7nfRdLS8o/edit?tab=t.0. This PR adds .github/workflows/publish-v1-specs.yml a workflow that sits downstream of the LockAndPublishPrivatePreviewSpecs, pulls the specs from the CDN and publishes v1 private-preview specs for a given API version.

It is functionally equivalent to the private-preview (beta) path of pay-server's api-codegen/tools/publish.sh. The difference is that specs are pulled from the CDN instead of a local build dir.

How it works

  1. Checks out openapi with full history + tags.
  2. Checks out stripe/sdk-codegen@v17.0.0 + just + Node 24 to provide the diff CLI.
  3. Downloads required specs and optional fixtures from the CDN into openapi/.
  4. Commits fixtures, then the private-preview spec, if changed. When the spec changes, generates rest.md + 7 per-language diffs, commits upcoming-changes/, tags vN, and pushes atomically.

dry_run

A dry_run input (default true) fetches, builds, and diffs but does not touch master or tags. Instead it force-pushes the local commits to a disposable branch so you can inspect exactly what a real run would commit. Tags are never created/pushed in a dry run.

Context

Triggered by the zoolander LockAndReleasePrivatePreviewSpecs workflow, which currently dispatches stripe/openapi under a PLACEHOLDER_WORKFLOW_NAME. Swapping that placeholder for this workflow's filename is a separate, follow-up mint PR.

Note: a full end-to-end test requires a dry-run zoolander run to first publish a version to the CDN.

zacchua-stripe and others added 2 commits August 20, 2026 14:57
Adds a workflow_dispatch workflow that publishes v1 private-preview specs
for a given API version and cuts a release, mirroring the private-preview
(beta) path of pay-server's api-codegen/tools/publish.sh.

It pulls the specs from the Statics Commander CDN (instead of a local build
dir), commits them to master, generates per-language diffs against the
private-preview spec, and tags the release. Triggered by the zoolander
LockAndReleasePrivatePreviewSpecs workflow.

A dry_run input (default true) fetches, builds, and diffs without pushing,
uploading the would-be output as an artifact for inspection.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Committed-By-Agent: claude
- Diff the GA spec (openapi/spec3.sdk.yaml), old-tag vs. working tree,
  exactly as publish.sh's beta path does, instead of the private-preview spec.
- In dry-run, force-push local commits to a disposable dry-run/private-preview
  branch for inspection instead of uploading an artifact; never create or push
  a tag (a stray vN would corrupt the next real run's describe increment).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Committed-By-Agent: claude
Comment thread .github/workflows/publish-private-preview.yml Outdated
Comment thread .github/workflows/publish-private-preview.yml Outdated
Adds a `mode` choice input (private-preview / public-preview / GA / all).
Only private-preview is implemented; the other channels fail fast at a new
"Resolve mode configuration" step until the zoolander dispatcher and CDN keys
for them are wired up. Mode-specific values (CDN subpath, spec/fixture
filenames, commit and tag messages, dry-run branch) are resolved into env vars
so the download and release steps stay mode-agnostic. Dry-run branch is now
dry-run/<mode>.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Committed-By-Agent: claude
@zacchua-stripe
zacchua-stripe marked this pull request as ready for review August 21, 2026 18:28
@zacchua-stripe
zacchua-stripe requested a review from xavdid August 21, 2026 18:28
@zacchua-stripe zacchua-stripe changed the title Add publish-private-preview workflow Add publish-v1-specs workflow Aug 21, 2026

@xavdid xavdid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had a couple of nits, but the big blocker is to use the more secure Github actions (and figuring out why that didn't get flagged here in the first place)

runs-on: ubuntu-latest
steps:
- name: Fetch app installation token
uses: tibdex/github-app-token@v1.5.2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and all other actions) should be using the new action and pinned hashes from #194

I'm actually surprised there wasn't a new CI job that failed on this branch because you're not pinning a version. so maybe double check why it didn't yell at you 😅

options:
- private-preview
- public-preview
- GA

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is uppercase but the rest are lowercase

- public-preview
- GA
- all
dry_run:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine, but should we invert it? Like, push_changes or something? dry_run: false is sort of a double negative, so it's a pet peeve of mine (especially if true is the default)

export PATH="${PWD}/node_modules/.bin:${PATH}"

# `rest.md` is the language-agnostic diff (no --lang), matching publish.sh.
node ./dist/main.js diff --old-path "$OLD_SPEC" --new-path "$NEW_SPEC" --output-path "$DIFF_DIR/rest.md"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would use just --no-deps diff ... instead of reaching into main.js directly

uses: actions/checkout@v4
with:
repository: stripe/sdk-codegen
ref: v17.0.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to pin a specific codegen version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants