From 7e3df5b636ef01a736079d23d9ec8084a99767f7 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Thu, 9 May 2024 11:00:35 -0700 Subject: [PATCH] feat: correctly set releases dir in monorepo mode --- 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 != "." {