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

Reusable workflow uses workflow_dispatch default instead of passed input value #2464

Open
Wenzel opened this issue Sep 18, 2024 · 4 comments · May be fixed by #2502
Open

Reusable workflow uses workflow_dispatch default instead of passed input value #2464

Wenzel opened this issue Sep 18, 2024 · 4 comments · May be fixed by #2502
Labels
kind/bug Something isn't working

Comments

@Wenzel
Copy link

Wenzel commented Sep 18, 2024

Bug report info

act version:            0.2.67
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
Config files:           
	/home/wenzel/.config/act/actrc:
		-P ubuntu-latest=catthehacker/ubuntu:act-latest
		-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
		-P ubuntu-20.04=catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
	Go version:            go1.21.13
	Module path:           github.com/nektos/act
	Main version:          (devel)
	Main path:             github.com/nektos/act
	Main checksum:         
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -s -w -X main.version=0.2.67 -X main.commit=f75a2d8b38cc3b929ab652c0994d6d33f6584ed9 -X main.date=2024-09-10T18:17:24Z -X main.builtBy=goreleaser
		CGO_ENABLED:          0
		GOARCH:               amd64
		GOOS:                 linux
		GOAMD64:              v1
		vcs:                  git
		vcs.revision:         f75a2d8b38cc3b929ab652c0994d6d33f6584ed9
		vcs.time:             2024-09-10T18:17:07Z
		vcs.modified:         false
Docker Engine:
	Engine version:        25.0.2
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         systemd
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Ubuntu 23.10
	OS type:               linux
	OS version:            23.10
	OS arch:               x86_64
	OS kernel:             6.5.0-44-generic
	OS CPU:                16
	OS memory:             15609 MB
	Security options:
		name=apparmor
		name=seccomp,profile=builtin
		name=cgroupns

Command used with act

act workflow_dispatch -W .github/workflows/main.yml -P self-hosted=-self-hosted -v

Describe issue

When using a reusable workflow that defines the same input parameter in both its workflow_call and workflow_dispatch events, the workflow incorrectly uses the default value from the workflow_dispatch event instead of the value passed from the calling workflow.
Steps to reproduce:

  • Create a main workflow that calls a reusable workflow, passing a specific value for an input parameter.
  • In the reusable workflow, define the same input parameter in both workflow_call and workflow_dispatch events, with different default values.
  • Run the main workflow.

See the Dockerfile for repro

Link to GitHub repository

No response

Workflow content

name: Main Workflow
on:
  workflow_dispatch:
    inputs:
      passed_input:
        type: string
        required: true
        default: "default_value_dispatch"
jobs:
  call_reusable:
    uses: ./.github/workflows/reusable.yml
    with:
      passed_input: "Hello World"



name: Reusable Workflow
on:
  workflow_dispatch:
    inputs:
      passed_input:
        type: string
        required: true
        default: "default_value_dispatch"
  workflow_call:
    inputs:
      passed_input:
        type: string
        required: true
        default: "default_value_call"
jobs:
  reusable_job:
    runs-on: self-hosted
    steps:
        # should be "Hello World" !
        # but we get the default value of workflow_dispatch instead !
      - name: Display passed input
        run: |
          echo "input.passed_input: ${{ inputs.passed_input }}"

Relevant log output

DEBU[0000] Handling container host and socket           
DEBU[0000] Defaulting container socket to default ''    
WARN[0000] Couldn't get a valid docker connection: no DOCKER_HOST and an invalid container socket '' 
DEBU[0000] Loading environment from /repo/.env          
DEBU[0000] Loading action inputs from /repo/.input      
DEBU[0000] Loading secrets from /repo/.secrets          
DEBU[0000] Loading vars from /repo/.vars                
DEBU[0000] Evaluated matrix inclusions: map[]           
DEBU[0000] Loading workflow '/repo/.github/workflows/main.yml' 
DEBU[0000] Reading workflow '/repo/.github/workflows/main.yml' 
DEBU[0000] Unable to load etag from /root/.cache/act/.notices.etag: &{%!e(string=open) %!e(string=/root/.cache/act/.notices.etag) %!e(syscall.Errno=2)} 
DEBU[0000] Using first passed in arguments event for filtering: workflow_dispatch 
DEBU[0000] Preparing plan for a event: workflow_dispatch 
DEBU[0000] Using first passed in arguments event: workflow_dispatch 
DEBU[0000] Planning jobs for event: workflow_dispatch   
DEBU[0000] gc: 2024-09-18 14:28:12.353815707 +0000 UTC m=+0.041078425  module=artifactcache
DEBU[0000] Plan Stages: [0xc0004418a8]                  
DEBU[0000] Stages Runs: [call_reusable]                 
DEBU[0000] Job.Name: call_reusable                      
DEBU[0000] Job.RawNeeds: {0 0    <nil> []    0 0}       
DEBU[0000] Job.RawRunsOn: {0 0    <nil> []    0 0}      
DEBU[0000] Job.Env: {0 0    <nil> []    0 0}            
DEBU[0000] Job.If: {0 0  success()  <nil> []    0 0}    
DEBU[0000] Job.TimeoutMinutes:                          
DEBU[0000] Job.Services: map[]                          
DEBU[0000] Job.Strategy: <nil>                          
DEBU[0000] Job.RawContainer: {0 0    <nil> []    0 0}   
DEBU[0000] Job.Defaults.Run.Shell:                      
DEBU[0000] Job.Defaults.Run.WorkingDirectory:           
DEBU[0000] Job.Outputs: map[]                           
DEBU[0000] Job.Uses: ./.github/workflows/reusable.yml   
DEBU[0000] Job.With: map[passed_input:Hello World]      
DEBU[0000] Job.Result:                                  
DEBU[0000] Empty Strategy, matrixes=[map[]]             
DEBU[0000] Job Matrices: [map[]]                        
DEBU[0000] Runner Matrices: map[]                       
DEBU[0000] Final matrix after applying user inclusions '[map[]]' 
WARN[0000] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found 
DEBU[0000] Loading revision from git directory          
DEBU[0000] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5 
DEBU[0000] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5' 
DEBU[0000] using github ref: refs/heads/master          
DEBU[0000] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5 
DEBU[0000] Detected CPUs: 16                            
[Main Workflow/call_reusable] [DEBUG] evaluating expression 'success()'
[Main Workflow/call_reusable] [DEBUG] expression 'success()' evaluated to 'true'
DEBU[0000] Loading workflow '/repo/.github/workflows/reusable.yml' 
DEBU[0000] Reading workflow '/repo/.github/workflows/reusable.yml' 
DEBU[0000] Plan Stages: [0xc0004406a8]                  
DEBU[0000] Stages Runs: [reusable_job]                  
DEBU[0000] Job.Name: reusable_job                       
DEBU[0000] Job.RawNeeds: {0 0    <nil> []    0 0}       
DEBU[0000] Job.RawRunsOn: {8 0 !!str self-hosted  <nil> []    17 14} 
DEBU[0000] Job.Env: {0 0    <nil> []    0 0}            
DEBU[0000] Job.If: {0 0  success()  <nil> []    0 0}    
DEBU[0000] Job.Steps: Display passed input              
DEBU[0000] Job.TimeoutMinutes:                          
DEBU[0000] Job.Services: map[]                          
DEBU[0000] Job.Strategy: <nil>                          
DEBU[0000] Job.RawContainer: {0 0    <nil> []    0 0}   
DEBU[0000] Job.Defaults.Run.Shell:                      
DEBU[0000] Job.Defaults.Run.WorkingDirectory:           
DEBU[0000] Job.Outputs: map[]                           
DEBU[0000] Job.Uses:                                    
DEBU[0000] Job.With: map[]                              
DEBU[0000] Job.Result:                                  
DEBU[0000] Empty Strategy, matrixes=[map[]]             
DEBU[0000] Job Matrices: [map[]]                        
DEBU[0000] Runner Matrices: map[]                       
DEBU[0000] Final matrix after applying user inclusions '[map[]]' 
[Main Workflow/call_reusable] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[Main Workflow/call_reusable] [DEBUG] Loading revision from git directory
[Main Workflow/call_reusable] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[Main Workflow/call_reusable] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[Main Workflow/call_reusable] [DEBUG] using github ref: refs/heads/master
[Main Workflow/call_reusable] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
DEBU[0000] Detected CPUs: 16                            
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] evaluating expression 'success()'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] expression 'success()' evaluated to 'true'
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://172.17.0.2:37609/ CI:true GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_EVENT_NAME:workflow_dispatch GITHUB_EVENT_PATH:/root/.cache/act/c228450c6703b3f9/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:reusable_job GITHUB_REF:refs/heads/master GITHUB_REF_NAME:master GITHUB_REF_TYPE:branch GITHUB_REPOSITORY: GITHUB_REPOSITORY_OWNER: GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:f783bc5c5d17fe15daaaa9daf28910aa93f982b5 GITHUB_WORKFLOW:Reusable Workflow GITHUB_WORKSPACE:/root/.cache/act/c228450c6703b3f9/hostexecutor HOME:/root HOSTNAME:6393f7ac73d7 ImageOS:selfhosted PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD:/repo RUNNER_ARCH:amd64 RUNNER_OS:Linux RUNNER_PERFLOG:/dev/null RUNNER_TEMP:/root/.cache/act/c228450c6703b3f9/tmp RUNNER_TOOL_CACHE:/root/.cache/act/tool_cache RUNNER_TRACKING_ID: TERM:xterm]
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] evaluating expression ''
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] expression '' evaluated to 'true'
[call_reusable/Reusable Workflow/reusable_job] ⭐ Run Main Display passed input
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] expression 'echo "input.passed_input: ${{ inputs.passed_input }}"
' rewritten to 'format('echo "input.passed_input: {0}"
', inputs.passed_input)'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] evaluating expression 'format('echo "input.passed_input: {0}"
', inputs.passed_input)'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] expression 'format('echo "input.passed_input: {0}"
', inputs.passed_input)' evaluated to '%!t(string=echo "input.passed_input: default_value_dispatch"
)'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Wrote command 

echo "input.passed_input: default_value_dispatch"


 to 'workflow/0.sh'
| input.passed_input: default_value_dispatch
[call_reusable/Reusable Workflow/reusable_job]   ✅  Success - Main Display passed input
[call_reusable/Reusable Workflow/reusable_job] Cleaning up container for job reusable_job
[call_reusable/Reusable Workflow/reusable_job] 🏁  Job succeeded
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] unable to get git repo (githubInstance: github.com; remoteName: origin, repoPath: /repo): remote not found
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Loading revision from git directory
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] HEAD points to 'f783bc5c5d17fe15daaaa9daf28910aa93f982b5'
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] using github ref: refs/heads/master
[call_reusable/Reusable Workflow/reusable_job] [DEBUG] Found revision: f783bc5c5d17fe15daaaa9daf28910aa93f982b5
DEBU[0000] Saving notices etag=7dcbfdd4-8c6c-4c4a-a697-e7a76a894f72

Additional information

Dockerfile to repro the issue easily:

FROM ubuntu:20.04

RUN apt-get update && apt-get install -y curl git && \
    curl https://raw.githubusercontent.com/nektos/act/master/install.sh | bash && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

WORKDIR /repo

# Initialize git repo
RUN git init

# Create .github/workflows directory
RUN mkdir -p .github/workflows

# Create main workflow
COPY <<EOF .github/workflows/main.yml
name: Main Workflow
on:
  workflow_dispatch:
    inputs:
      passed_input:
        type: string
        required: true
        default: "default_value_dispatch"
jobs:
  call_reusable:
    uses: ./.github/workflows/reusable.yml
    with:
      passed_input: "Hello World"
EOF

# Create reusable workflow with conditional test
COPY <<EOF .github/workflows/reusable.yml
name: Reusable Workflow
on:
  workflow_dispatch:
    inputs:
      passed_input:
        type: string
        required: true
        default: "default_value_dispatch"
  workflow_call:
    inputs:
      passed_input:
        type: string
        required: true
        default: "default_value_call"
jobs:
  reusable_job:
    runs-on: self-hosted
    steps:
        # should be "Hello World" !
        # but we get the default value of workflow_dispatch instead !
      - name: Display passed input
        run: |
          echo "input.passed_input: \${{ inputs.passed_input }}"
EOF

# Add and commit the workflows
RUN git add . && git config --global user.email "[email protected]" && \
    git config --global user.name "Your Name" && \
    git commit -m "Add workflows"

CMD act workflow_dispatch -W .github/workflows/main.yml -P self-hosted=-self-hosted -v
@Wenzel Wenzel added the kind/bug Something isn't working label Sep 18, 2024
@blackhatcrazy
Copy link

Do you have already a plan when or how this could be tackled?

@mahmud2011
Copy link

Hello, if the issue is not taken then I am interested to contribute. I would greatly appreciate any guidance or direction from a regular contributor to help me get started effectively.

@mahmud2011
Copy link

func newReusableWorkflowExecutor(rc *RunContext, directory string, workflow string) common.Executor {
return func(ctx context.Context) error {
planner, err := model.NewWorkflowPlanner(path.Join(directory, workflow), true)
if err != nil {
return err
}
plan, err := planner.PlanEvent("workflow_call")
if err != nil {
return err
}
runner, err := NewReusableWorkflowRunner(rc)
if err != nil {
return err
}
return runner.NewPlanExecutor(plan)(ctx)
}
}
func NewReusableWorkflowRunner(rc *RunContext) (Runner, error) {
runner := &runnerImpl{
config: rc.Config,
eventJSON: rc.EventJSON,
caller: &caller{
runContext: rc,
},
}

From initial investigation I found out, for reusable workflow PlanEvent is being called with workflow_call but NewReusableWorkflowRunner is being initialized using the passed down rc with workflow_dispatch.

Before initializing the ReusableWorkflowRunner the rc -> config -> EventName needs to be overwritten with workflow_call.

This fix still doesn't resolve the issue. Now the event is correct workflow_call but the values are incorrect as it's using the default values of workflow_call.

I am still figuring out where the values from main workflow is passed to the reuse workflow.

@ChristopherHX
Copy link
Contributor

Yes you can take this issue, this doesn't fit into my capacity for act to work on this year

Now the event is correct workflow_call

workflow_call is not an event that ever appears in github.event_name

workflow_dispatch is correct in reusable workflows triggered by a workflow that used event workflow_dispatch.

Reusable workflows in act are unfinished and unmaintained, after those working on them left

I am still figuring out where the values from main workflow is passed to the reuse workflow

Yes this is confusing, especially if someone uses the act workflow_call to bypass some logic as well.

I assume act push works? if your parent workflow uses anything different from workflow_dispatch.

mahmud2011 added a commit to mahmud2011/act that referenced this issue Oct 24, 2024
mahmud2011 added a commit to mahmud2011/act that referenced this issue Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
4 participants