// Code generated by actions-generator. DO NOT EDIT.

package main

import "fmt"

func New() *HelloWorldJavascriptAction {
	return &HelloWorldJavascriptAction{}
}

type HelloWorldJavascriptAction struct{}

// Runs the actions/hello-world-javascript-action GitHub Action.
func (_ *HelloWorldJavascriptAction) Run(
	// Directory containing the repository source. Takes precedence over `--repo`."
	// +optional=true
	source *Directory,
	// Repository name, format: owner/name.
	// +optional=true
	repo string,
	// Tag name to check out. Only works with `--repo`. Takes precedence over `--branch`.
	// +optional=true
	tag string,
	// Branch name to check out. Only works with `--repo`.
	// +optional=true
	branch string,
	// Container to use for the runner.
	// +optional=true
	container *Container,
	// Enables debug mode.
	// +optional=true
	// +default=false
	runnerDebug bool,
	// Who to greet
	// +optional=true
	// +default=World
	whoToGreet string,
) *Container {
	return dag.Gale(toGaleOpts(source, repo, tag, branch)).
		Action("actions/hello-world-javascript-action@main", toGaleActionOpts(whoToGreet)).
		Run(toGaleActionRunOpts(container, runnerDebug)).
		Sync()
}

// Converts the custom action inputs to Gale options.
func toGaleOpts(
	source *Directory,
	repo string,
	tag string,
	branch string,
) GaleOpts {
	return GaleOpts{
		Branch: branch,
		Repo:   repo,
		Source: source,
		Tag:    tag,
	}
}

// Converts the custom action inputs to Gale action run options.
func toGaleActionRunOpts(
	container *Container,
	debug bool,
) GaleActionsRunOpts {
	return GaleActionsRunOpts{
		Container:   container,
		RunnerDebug: debug,
	}
}

// Converts the custom action inputs to Gale action options.
func toGaleActionOpts(
	whoToGreet string,
) GaleActionOpts {
	return GaleActionOpts{
		With: []string{
			fmt.Sprintf("who-to-greet=%s", whoToGreet),
		},
	}
}
