mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #2483] If conditions not evaluated correctly in with re-usable workflows #1148
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#1148
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 @donatobarone on GitHub (Oct 10, 2024).
Original GitHub issue: https://github.com/nektos/act/issues/2483
Bug report info
Command used with act
Describe issue
When using reusable workflows context, specifically the inputs seem to be lost when an if statement is being evaluated. I am specifically referring to the call in action_1 which tries to call action_2 with the if statement. It seems that at this point when the evaluator is being setup for that step to determine if it is enabled or not, the inputs are the ones from the called action which is action_2, but not from action_1. Specifically in this I am assuming something is happening that is using the wrong env or anyway is not appending the caller ones. From the debugger I can see that the only INPUT_ env variable when evaluating that condition ${{ inputs.first_condition == 'true' }} is INPUT_INPUT_FOR_ACTION_2 and so the evaluation returns a false rather than a true.
Link to GitHub repository
No response
Workflow content
Relevant log output
Additional information
In order to make this work locally I had to do a small change here, essentially when using reusable workflows locally it would try to get the code from the docker, but whilst using localrepository or just using local actions it would try to get those from the container but of course they are not there. So I have added an extra step in there to fetch the file from local
@ChristopherHX commented on GitHub (Oct 10, 2024):
This is an dupe of https://github.com/nektos/act/issues/2426, release of 1. Nov. 2024 would ship the correction
Sounds more like an usage error.
Local actions (not reusable workflows) are loaded from the job.
You clearly miss the actions/checkout@v4 as first step.
I removed reads from filesystem, because this is plainly wrong behavior.
--local-repository is used to map remote uses to local folders.
Sometimes are feature requests for Actions raised in act that are not compatible with GitHubs behavior, later bug reports want a revert of the behavior as it doesn't match GitHib
@donatobarone commented on GitHub (Oct 11, 2024):
Thanks @ChristopherHX for pointing this out https://github.com/nektos/act/issues/2426, I tried to look for a similar issue but I failed :D
About the second point, makes sense and I understand the design decision there, I guess my only point about it is that act is supposed to help with the sprawling of commits that you might end up doing to develop a github action by running it locally. Now if I have to commit every time I have a change for a re-usable workflow that I have locally that feels like less of an argument to using act, not sure if that is clear, that is why I was curious if that was intended behaviour or not.
@ChristopherHX commented on GitHub (Oct 11, 2024):
The answer is no.
- uses: actions/checkout@v4is replaced by something like docker cp from your act workdir. Those it makes local actions available.if you checkout step has some stuff in
withthen you are right that act will use the actual checkout action to do that.Even then it is possible to provide your own local action that replaces
- uses: actions/checkout@v4even with awithblockSchematic, add more cli options and change paths of your local drive
Imagine you have a workflow that uses a reusable workflow in a job like
uses: myorg/myreusablerepo/.github/workflows/test.yml@mainThen the following maps it to your local disc drive
@donatobarone commented on GitHub (Oct 11, 2024):
@ChristopherHX thanks a lot for taking the time to explain this further. We do indeed have with in the checkout action, but still I appreciate the time you took to explain it to me, I will resolve this for now. I have validated the latest version of master and it works, so closing this issue