mirror of
https://github.com/nektos/act.git
synced 2026-04-26 17:35:49 +03:00
[GH-ISSUE #2464] Reusable workflow uses workflow_dispatch default instead of passed input value #1136
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#1136
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Wenzel on GitHub (Sep 18, 2024).
Original GitHub issue: https://github.com/nektos/act/issues/2464
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:
@blackhatcrazy commented on GitHub (Oct 11, 2024):
Do you have already a plan when or how this could be tackled?
@mahmud2011 commented on GitHub (Oct 22, 2024):
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 commented on GitHub (Oct 22, 2024):
github.com/nektos/act@03a4480cd0/pkg/runner/reusable_workflow.go (L116-L144)From initial investigation I found out, for reusable workflow
PlanEventis being called withworkflow_callbutNewReusableWorkflowRunneris being initialized using the passed downrcwithworkflow_dispatch.Before initializing the
ReusableWorkflowRunnertherc->config->EventNameneeds to be overwritten withworkflow_call.This fix still doesn't resolve the issue. Now the event is correct
workflow_callbut the values are incorrect as it's using the default values ofworkflow_call.I am still figuring out where the values from main workflow is passed to the reuse workflow.
@ChristopherHX commented on GitHub (Oct 23, 2024):
Yes you can take this issue, this doesn't fit into my capacity for act to work on this year
workflow_callis not an event that ever appears ingithub.event_nameworkflow_dispatchis correct in reusable workflows triggered by a workflow that used eventworkflow_dispatch.Reusable workflows in act are unfinished and unmaintained, after those working on them left
Yes this is confusing, especially if someone uses the
act workflow_callto bypass some logic as well.I assume
act pushworks? if your parent workflow uses anything different fromworkflow_dispatch.@inkarkat commented on GitHub (Dec 19, 2024):
That's a proper workaround for me; glad I found this! I was struggling to understand why my local runs suddenly started failing once I had extracted a common resuable workflow...
In my case, the main workflows directly define inputs for the reusable workflow which is triggered on both workflow_dispatch and workflow_call events (to run the workflow itself as a demo and self-test, but mainly to be triggered by other projects). Like in OP's case, the passed inputs are ignored and instead the defaults from
workflow_dispatchare used, causing the workflow to fail.