Skip to content

Commit

Permalink
feat: provide target in run workflow (#109)
Browse files Browse the repository at this point in the history
* feat: provide target in run workflow

* feat: provide target in run workflow
  • Loading branch information
ryan-timothy-albert authored Apr 10, 2024
1 parent 7333b83 commit bd37d99
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/workflow-executor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ on:
default: "direct"
required: false
type: string
target:
description: "Generate a specific target by name"
required: false
type: string
force:
description: "Force the generation of the SDKs"
default: "false"
Expand Down Expand Up @@ -134,6 +138,7 @@ jobs:
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
working_directory: ${{ inputs.working_directory }}
openapi_doc_auth_token: ${{ secrets.openapi_doc_auth_token }}
target: ${{ inputs.target }}
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ inputs:
description: "Force the SDK to be regenerated"
default: "false"
required: false
target:
description: "Generate a specific target by name"
required: false
max_suggestions:
description: "The maximum number of suggestions to apply when using the 'suggest' action step."
default: "5"
Expand Down Expand Up @@ -157,3 +160,4 @@ runs:
- ${{ inputs.working_directory }}
- ${{ inputs.gpg_fingerprint }}
- ${{ inputs.openapi_doc_auth_token }}
- ${{ inputs.target }}
7 changes: 6 additions & 1 deletion internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ func Run(sourcesOnly bool, installationURLs map[string]string, repoURL string, r
if sourcesOnly {
args = append(args, "-s", "all")
} else {
args = append(args, "-t", "all")
specifiedTarget := environment.SpecifiedTarget()
if specifiedTarget != "" {
args = append(args, "-t", specifiedTarget)
} else {
args = append(args, "-t", "all")
}
urls, err := json.Marshal(installationURLs)
if err != nil {
return fmt.Errorf("error marshalling installation urls: %w", err)
Expand Down
4 changes: 4 additions & 0 deletions internal/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func ForceGeneration() bool {
return os.Getenv("INPUT_FORCE") == "true"
}

func SpecifiedTarget() string {
return os.Getenv("INPUT_TARGET")
}

func GetMode() Mode {
mode := os.Getenv("INPUT_MODE")
if mode == "" {
Expand Down

0 comments on commit bd37d99

Please sign in to comment.