diff --git a/cmd/root.go b/cmd/root.go index bbe6917b836..a56575b60a1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -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"}, diff --git a/pkg/container/host_environment.go b/pkg/container/host_environment.go index 0103ebdb2f0..d4a9869d070 100644 --- a/pkg/container/host_environment.go +++ b/pkg/container/host_environment.go @@ -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 diff --git a/pkg/model/workflow.go b/pkg/model/workflow.go index 57e8f57dc61..d67ce414c13 100644 --- a/pkg/model/workflow.go +++ b/pkg/model/workflow.go @@ -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"` diff --git a/pkg/model/workflow_test.go b/pkg/model/workflow_test.go index 92de8ca33fe..4ee37109904 100644 --- a/pkg/model/workflow_test.go +++ b/pkg/model/workflow_test.go @@ -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}'"}, diff --git a/pkg/runner/expression.go b/pkg/runner/expression.go index 90643d09119..b970d62c041 100644 --- a/pkg/runner/expression.go +++ b/pkg/runner/expression.go @@ -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" { config := rc.Run.Workflow.WorkflowDispatchConfig() if config != nil && config.Inputs != nil { for k, v := range config.Inputs { diff --git a/pkg/runner/runner_test.go b/pkg/runner/runner_test.go index 82defd77661..8f49302d485 100644 --- a/pkg/runner/runner_test.go +++ b/pkg/runner/runner_test.go @@ -305,6 +305,7 @@ func TestRunEvent(t *testing.T) { {workdir, "workflow_dispatch_no_inputs_mapping", "workflow_dispatch", "", platforms, secrets}, {workdir, "workflow_dispatch-scalar", "workflow_dispatch", "", platforms, secrets}, {workdir, "workflow_dispatch-scalar-composite-action", "workflow_dispatch", "", platforms, secrets}, + {workdir, "uses-workflow-defaults", "workflow_dispatch", "", platforms, secrets}, {workdir, "job-needs-context-contains-result", "push", "", platforms, secrets}, {"../model/testdata", "strategy", "push", "", platforms, secrets}, // TODO: move all testdata into pkg so we can validate it with planner and runner {"../model/testdata", "container-volumes", "push", "", platforms, secrets}, diff --git a/pkg/runner/testdata/.github/workflows/local-reusable-and-dispatch.yml b/pkg/runner/testdata/.github/workflows/local-reusable-and-dispatch.yml new file mode 100644 index 00000000000..0b9e890bd7b --- /dev/null +++ b/pkg/runner/testdata/.github/workflows/local-reusable-and-dispatch.yml @@ -0,0 +1,30 @@ +name: reuse + +on: + workflow_dispatch: + inputs: + my-val: + type: string + required: true + default: "default_value_reuse_workflow_dispatch_call" + dispatch-val: + type: string + default: "I am a dispatch var for checking if I am being used in workflow_call" + + workflow_call: + inputs: + my-val: + type: string + required: true + default: "default_value_reuse_workflow_call" + +jobs: + reusable_workflow_job: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run a one-line script + run: echo "✅ 🚀 ✅ hello this is from workflow reuse. Value - " ${{ inputs.my-val }} ${{ github.event_name }} ${{ inputs.dispatch-val }} + - name: Assert + run: | + exit ${{ ( inputs.my-val == 'default_value_reuse_workflow_call' || inputs.my-val == 'passed value from main' ) && !inputs.dispatch-val && '0' || '1' }} \ No newline at end of file diff --git a/pkg/runner/testdata/uses-workflow-defaults/workflow_dispatch.yml b/pkg/runner/testdata/uses-workflow-defaults/workflow_dispatch.yml new file mode 100644 index 00000000000..e87d9cbd08b --- /dev/null +++ b/pkg/runner/testdata/uses-workflow-defaults/workflow_dispatch.yml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run a one-line script + run: echo "✅ 🚀 ✅ hello this is from workflow main" ${{ github.event_name }} + call-reuse-w-val: + uses: ./.github/workflows/local-reusable-and-dispatch.yml + with: + my-val: "passed value from main"