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 "you@example.com" && \
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
Bug report info
Command used with act
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:
See the Dockerfile for repro
Link to GitHub repository
No response
Workflow content
Relevant log output
Additional information
Dockerfile to repro the issue easily: