-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
if
condition in composite action misbehaves with uses
#2426
Comments
I have the same issue and the only condition that seems work is testing for null
|
I have a similar issue. This works as expected, and prints out "Works! And this says 'true': true" - name: Shell command
if: ${{ (fromJSON(inputs.myinput) == true }}
shell: bash
run: echo "Works! And this says 'true': ${{ fromJSON(inputs. inputs.myinput) }}" However, this next one one errors out: - name: Run another action
if: ${{ fromJSON(inputs.myinput) == true }}
uses: myrepo/myaction@main
My guess is that somehow the input is being forgotten, returning a null object or something that causes |
Regression of #2348? Missing / unreliable tests of the code |
I'm seeing the same behavior. My team makes heavy use of composite actions and being able to use this tool would have a significant impact for us.
@ChristopherHX Correct me if I'm wrong, but I believe the tests added in that PR won't detect an issue like this because the problem only surfaces when an |
I meant this bug might has been caused by #2348. It doesn't read like we have the same impression what I meant. So a first step to see if reverting that specifc commit works and run go build to get a binary, then verify if my assumption is correct. Next steps would be to either propose a revert of #2348 and rerelease act or figure out to solve both the defect that PR aimed to fix and this one.
Downgrading act to a version (GitHub shows tags including the merged commit, just use the one lower) without that change is a temporary consumer solution I don't expect any resolution this month, my focus is on different projects. This is on my backlog, my work for act cli is currently slow |
Confirmed as Regression due to mergin #2348 name: "Test Composite Action"
description: "Test action uses composite"
inputs:
b:
default: true
b2: {}
runs:
using: "composite"
steps:
- uses: actions/github-script@v7
if: inputs.b == 'true'
with:
script: |
console.log(${{ tojson(inputs) }})
if( ${{ tojson(inputs.b) }} != 'true' ) {
process.exit(-1);
}
github-token: noop
- uses: actions/github-script@v7
if: inputs.b != 'true'
with:
script: |
console.log(${{ tojson(inputs) }})
if( ${{ tojson(inputs.b) }} == 'true' ) {
process.exit(-1);
}
github-token: noop
- uses: actions/github-script@v7
if: inputs.b2 == 'false'
with:
script: |
console.log(${{ tojson(inputs) }})
if( ${{ tojson(inputs.b2) }} != 'false' ) {
process.exit(-1);
}
github-token: noop
- uses: actions/github-script@v7
if: inputs.b2 != 'false'
with:
script: |
console.log(${{ tojson(inputs) }})
if( ${{ tojson(inputs.b2) }} == 'false' ) {
process.exit(-1);
}
github-token: noop called by name: uses-composite-check-for-input-in-if-uses
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./uses-composite-check-for-input-in-if-uses/composite_action
with:
b: true
b2: true
- uses: ./uses-composite-check-for-input-in-if-uses/composite_action
with:
b: false
b2: false
- uses: ./uses-composite-check-for-input-in-if-uses/composite_action
with:
b: true
b2: false
- uses: ./uses-composite-check-for-input-in-if-uses/composite_action
with:
b: false
b2: true I'm working on a fix right now, highest priority issue for act in my backlog. Issues filed as defects of github-act-runner are processed and merged faster. |
E.g. |
Help wanted to verify: #2473, awaiting review this can take unspecified amount of time Portable Binaries are in CI-Checks Artifacts of that PR, since act is all about GitHub Actions this should be self explaining. |
Bug report info
Command used with act
Describe issue
I'm passing a secret as an input to a composite action. In the composite action I want to run a third party action with
uses
based on whether the input is defined or not.When I use an
if
condition on a shell step it works correctly, however on the step thatuses
the third party action the expression is suddenly evaluated tofalse
.Link to GitHub repository
No response
Workflow content
Relevant log output
Additional information
My
event.json
only has base and head refs defined, nothing else.The text was updated successfully, but these errors were encountered: