From 9b0f9916b0a0be5afcfa55f8a5b29584d5b0ad22 Mon Sep 17 00:00:00 2001 From: Ryan Albert <42415738+ryan-timothy-albert@users.noreply.github.com> Date: Thu, 9 May 2024 12:43:51 -0700 Subject: [PATCH] feat: correctly set releases dir in monorepo mode (#124) --- internal/actions/utils.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/actions/utils.go b/internal/actions/utils.go index 6540dc23..f501b1eb 100644 --- a/internal/actions/utils.go +++ b/internal/actions/utils.go @@ -2,6 +2,7 @@ package actions import ( "github.com/speakeasy-api/sdk-generation-action/internal/configuration" + "github.com/speakeasy-api/sdk-generation-action/internal/environment" ) func getReleasesDir() (string, error) { @@ -12,6 +13,13 @@ func getReleasesDir() (string, error) { return "", err } + // Checking for multiple targets ensures backward compatibility with the code below + if len(wf.Targets) > 1 && environment.SpecifiedTarget() != "" { + if target, ok := wf.Targets[environment.SpecifiedTarget()]; ok && target.Output != nil { + return *target.Output, nil + } + } + for _, target := range wf.Targets { // If we are only generating one language and its not in the root directory we assume this is a multi-sdk repo if len(wf.Targets) == 1 && target.Output != nil && *target.Output != "." {