Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent unintended input replacement in reusable workflows with workflow_dispatch when using workflow_call #2502

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
func defaultImageSurvey(actrc string) error {
var answer string
confirmation := &survey.Select{
Message: "Please choose the default image you want to use with act:\n - Large size image: ca. 17GB download + 53.1GB storage, you will need 75GB of free disk space, snapshots of GitHub Hosted Runners without snap and pulled docker images\n - Medium size image: ~500MB, includes only necessary tools to bootstrap actions and aims to be compatible with most actions\n - Micro size image: <200MB, contains only NodeJS required to bootstrap actions, doesn't work with all actions\n\nDefault image and other options can be changed manually in " + configLocations()[0] + " (please refer to https://github.com/nektos/act#configuration for additional information about file structure)",
Message: "Please choose the default image you want to use with act:\n - Large size image: ca. 17GB download + 53.1GB storage, you will need 75GB of free disk space, snapshots of GitHub Hosted Runners without snap and pulled docker images\n - Medium size image: ~500MB, includes only necessary tools to bootstrap actions and aims to be compatible with most actions\n - Micro size image: <200MB, contains only NodeJS required to bootstrap actions, doesn't work with all actions\n\nDefault image and other options can be changed manually in " + configLocations()[0] + " (please refer to https://github.com/nektos/act#configuration for additional information about file structure)",
Help: "If you want to know why act asks you that, please go to https://github.com/nektos/act/issues/107",
Default: "Medium",
Options: []string{"Large", "Medium", "Micro"},
Expand Down
4 changes: 2 additions & 2 deletions pkg/container/host_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,9 @@ func goArchToActionArch(arch string) string {

func goOsToActionOs(os string) string {
osMapper := map[string]string{
"linux": "Linux",
"linux": "Linux",
"windows": "Windows",
"darwin": "macOS",
"darwin": "macOS",
}
if os, ok := osMapper[os]; ok {
return os
Expand Down
12 changes: 6 additions & 6 deletions pkg/model/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,12 @@ type ContainerSpec struct {

// Step is the structure of one step in a job
type Step struct {
ID string `yaml:"id"`
If yaml.Node `yaml:"if"`
Name string `yaml:"name"`
Uses string `yaml:"uses"`
Run string `yaml:"run"`
WorkingDirectory string `yaml:"working-directory"`
ID string `yaml:"id"`
If yaml.Node `yaml:"if"`
Name string `yaml:"name"`
Uses string `yaml:"uses"`
Run string `yaml:"run"`
WorkingDirectory string `yaml:"working-directory"`
// WorkflowShell is the shell really configured in the job, directly at step level or higher in defaults.run.shell
WorkflowShell string `yaml:"-"`
Shell string `yaml:"shell"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/model/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@ func TestReadWorkflow_Strategy(t *testing.T) {

func TestStep_ShellCommand(t *testing.T) {
tests := []struct {
shell string
shell string
workflowShell string
want string
want string
}{
{"pwsh -v '. {0}'", "", "pwsh -v '. {0}'"},
{"pwsh", "", "pwsh -command . '{0}'"},
Expand Down
2 changes: 1 addition & 1 deletion pkg/runner/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ func getEvaluatorInputs(ctx context.Context, rc *RunContext, step step, ghc *mod
}
}

if ghc.EventName == "workflow_dispatch" {
if rc.caller == nil && ghc.EventName == "workflow_dispatch" {
ChristopherHX marked this conversation as resolved.
Show resolved Hide resolved
config := rc.Run.Workflow.WorkflowDispatchConfig()
if config != nil && config.Inputs != nil {
for k, v := range config.Inputs {
Expand Down
Loading