From 84df2e2b83790c923cefceec1b74fc3f24918d4a Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 5 Dec 2024 17:19:55 -0500 Subject: [PATCH] feat: Support skip_testing input to explicitly skip target testing Reference: https://linear.app/speakeasy/issue/GEN-780/feature-sdk-generation-action-skip-target-testing-input Set to true to explicitly skip Speakeasy workflow target testing after generation, even when enabled in the Speakeasy workflow configuration. This is useful for running workflow testing as a separate GitHub Actions workflow without affecting/blocking generation. It can also be used to workaround potential testing bugs where the generation should still be preserved. --- .github/workflows/workflow-executor.yaml | 5 +++++ action.yml | 4 ++++ internal/cli/run.go | 4 ++++ internal/environment/environment.go | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/.github/workflows/workflow-executor.yaml b/.github/workflows/workflow-executor.yaml index a51c7ba8..d81805fc 100644 --- a/.github/workflows/workflow-executor.yaml +++ b/.github/workflows/workflow-executor.yaml @@ -78,6 +78,11 @@ on: description: "Version of pnpm to install. Not recommended for use without consulting Speakeasy support." required: false type: string + skip_testing: + description: "Set to true to explicitly skip Speakeasy workflow target testing after generation, even when enabled in the Speakeasy workflow configuration. This is useful for running workflow testing as a separate GitHub Actions workflow without affecting/blocking generation." + default: false + required: false + type: boolean secrets: github_access_token: description: A GitHub access token with write access to the repo diff --git a/action.yml b/action.yml index 4f1538d6..9ba2702f 100644 --- a/action.yml +++ b/action.yml @@ -94,6 +94,10 @@ inputs: pnpm_version: description: "Version of pnpm to install. Not recommended for use without consulting Speakeasy support." required: false + skip_testing: + description: "Set to true to explicitly skip Speakeasy workflow target testing after generation, even when enabled in the Speakeasy workflow configuration. This is useful for running workflow testing as a separate GitHub Actions workflow without affecting/blocking generation." + default: "false" + required: false outputs: publish_python: description: "Whether the Python SDK will be published to PyPi" diff --git a/internal/cli/run.go b/internal/cli/run.go index d7e6acaf..c6b73952 100644 --- a/internal/cli/run.go +++ b/internal/cli/run.go @@ -61,6 +61,10 @@ func Run(sourcesOnly bool, installationURLs map[string]string, repoURL string, r args = append(args, "--set-version", environment.SetVersion()) } + if environment.SkipTesting() { + args = append(args, "--skip-testing") + } + if environment.ForceGeneration() { fmt.Println("\nforce input enabled - setting SPEAKEASY_FORCE_GENERATION=true") os.Setenv("SPEAKEASY_FORCE_GENERATION", "true") diff --git a/internal/environment/environment.go b/internal/environment/environment.go index 4f72b6e1..eec23a69 100644 --- a/internal/environment/environment.go +++ b/internal/environment/environment.go @@ -97,6 +97,11 @@ func RegistryTags() string { return os.Getenv("INPUT_REGISTRY_TAGS") } +// Enabled if the INPUT_SKIP_TESTING environment variable is set to "true". +func SkipTesting() bool { + return os.Getenv("INPUT_SKIP_TESTING") == "true" +} + func SpecifiedTarget() string { return os.Getenv("INPUT_TARGET") }