Skip to content

Comments

feat: internalize CI#1897

Open
danielkov wants to merge 16 commits intomainfrom
danielkov/feat/ci-commands
Open

feat: internalize CI#1897
danielkov wants to merge 16 commits intomainfrom
danielkov/feat/ci-commands

Conversation

@danielkov
Copy link
Contributor

@danielkov danielkov commented Feb 18, 2026

Summary

Moves CI orchestration logic from sdk-generation-action into the CLI as speakeasy ci subcommands. This makes the GitHub Action a thin wrapper that installs the CLI and delegates to it, rather than owning the workflow logic itself.

What's new

  • speakeasy ci command group (hidden, not user-facing) with subcommands: generate, release, suggest, finalize, tag, test, log-result, publish-event, setup-env, pr-description
  • Full internal/ci/ package tree: environment detection, git operations, release management, telemetry, version bumps, document handling
  • All flags default from INPUT_* env vars so the GHA can pass inputs directly

Why

  • Lets us iterate on CI behavior with CLI releases instead of GHA ref updates
  • Makes CI logic testable and reusable beyond GitHub Actions
  • Reduces the action to install + invoke, simplifying maintenance

✻ Clauded...

@danielkov danielkov force-pushed the danielkov/feat/ci-commands branch 2 times, most recently from 677e571 to 5f22dd5 Compare February 19, 2026 16:40
Copy link
Member

@TristanSpeakEasy TristanSpeakEasy left a comment

Choose a reason for hiding this comment

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

LGTM — clean port overall. The structure is solid and the vast majority of the code is a faithful 1:1 carry-over from sdk-generation-action. Just two minor nits on new code introduced during the port.

func setEnvBool(key string, value bool) {
if value {
_ = os.Setenv(key, "true")
}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: setEnvBool is a no-op when value is false, which means a pre-existing truthy env var (e.g. INPUT_DEBUG=true) can't be turned off via --debug=false — downstream code reading os.Getenv will still see "true".

func setEnvBool(key string, value bool) {
    if value {
        _ = os.Setenv(key, "true")
    } else {
        _ = os.Setenv(key, "false")
    }
}

if pinnedVersion == "" {
return "latest"
}
if pinnedVersion != "latest" && (len(pinnedVersion) == 0 || pinnedVersion[0] != 'v') {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: len(pinnedVersion) == 0 is unreachable here — the empty case already returns "latest" on line 432. Can simplify to:

if pinnedVersion != "latest" && pinnedVersion[0] != 'v' {

EnableSDKChangelog string `json:"enable-sdk-changelog"`
OpenAPIDocLocation string `json:"openapi-doc-location"`
SignedCommits bool `json:"signed-commits"`
BranchName string `json:"branch-name"`
Copy link
Contributor

Choose a reason for hiding this comment

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

If we add more flags this will fail and break old CLIs. We should move all these flags into a single struct to enable forward compat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

enabled unknown args for ci + subcommands

danielkov and others added 15 commits February 21, 2026 18:35
Migrate CI/CD workflow logic from the external sdk-generation-action
repository into the main speakeasy CLI. This includes CI subcommands
(generate, publish, release, tag, finalize, etc.), git auth helpers,
environment setup, and supporting internal packages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename archives.format to archives.formats and brews to homebrew_casks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The cmd/ci/ stubs were only scaffolding - they set env vars then
returned "not yet implemented". Now they delegate to the actual
logic in internal/ci/actions/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
homebrew_casks has a different schema (no test/extra_install fields).
Revert to brews which is only a deprecation warning, not breaking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The old Docker-based action cloned the repo internally to {workspace}/repo/.
Now that it's a composite action, actions/checkout handles the checkout and
the CLI opens the repo from CWD via go-git DetectDotGit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The runbridge call used context.Background() which had no speakeasy
version set, causing a nil interface panic in GetSpeakeasyVersionFromContext.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
RunWithVisualization uses Bubble Tea which tries to open /dev/tty,
causing failure in CI environments where no TTY is available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a flag has DefaultValue from os.Getenv(), pflag doesn't mark
it as Changed, so the interactive validator treats it as missing.
These flags are always populated via INPUT_* env vars in CI.

✻ Clauded...
git.GetRepo() and getRepoMetadata() now respect
INPUT_GITHUB_REPOSITORY, falling back to GITHUB_REPOSITORY.
This fixes cross-repo scenarios where the workflow runs in one
repo but operates on a different SDK repo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GITHUB_* env vars are immutable in GitHub Actions and cannot be
overridden via GITHUB_ENV. Add GetGithubRef() that checks
INPUT_GITHUB_REF first, mirroring the existing GetRepo() pattern
with INPUT_GITHUB_REPOSITORY.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@danielkov danielkov force-pushed the danielkov/feat/ci-commands branch from b96da2e to dad68fb Compare February 21, 2026 18:35
setEnvBool now explicitly sets "false" so pre-existing env vars can be
overridden, and remove unreachable len check in formatPinnedVersion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants