You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@louisgv Well, ok, actually, I want the if: in composite actions to avoid running in shell which are not present in the system. So that I could make universal actions which would run in linux images, as well as windows ones (i.e. bash/powershell).
So, implementing check in bash is not an option for me since bash can be absent.
Reacted by akomakom, Alejandro Pedraza, Tom Thorogood, Gabriele Mambrini, vivin-kr, Dawid Weiss, Marten Seemann, Michael Karcher, Ivan Klass, Róbert Papp and 9 more
I'd like to have an action that does different things depending upon cancelled(), failure(), or success(), and these functions do not appear to be available inside of a run:
The workflow is not valid. .github/workflows/success.yaml (Line: 8, Col: 14): Unrecognized function: 'success'. Located at position 1 within expression: success()
lol, didn't even realize i needed an if conditional as well. I'm basically building a wrapper for actions/cache@v2 which requires if: steps.cacher.outputs.cache-hit != 'true' within my composite action. looking forward to this implementation!
Reacted by Notas Hellout, Brian Haslanger, David J. M. Karlsen, dh, Ville Lautanala, 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко), Adam Weigert, Sondre Lillebø Gundersen, Paco van der Linden, Sam Li and 13 more
Reacted by Mahmood Tahir and 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
Also have a need for this. It's the last thing keeping me from using composites similar to Azure DevOps pipeline templates...
Reacted by akomakom, Zaki Mughal [sivoais], Notas Hellout, Oliver Weiler, Sondre Lillebø Gundersen, callum-tait-pbx, Sam Li, Nils Brugger, Konrad, Rafael Melo and 6 more
actions/cache@v2 which requires if: steps.cacher.outputs.cache-hit != 'true' within my composite action
I came here looking for an answer to this - and with some inspiration from @louisgv I think I might have been able to come up with a temporary workaround until ifs are fully supported. Posting it here just in case anyone finds it useful:
I had some trouble with missing values as well @sebastianluszczek - perhaps it would help to set a default value for your input, and check against that, rather than using -z?
@AlexDHoffer it does work, although I have also had problems with matching on boolean true. I have solved it by ensuring that the output is always cast as a string (e.g. "true"), and then matching instead on the string value, like steps.tag_check.outputs.tag_exists != 'true'. I feel like this might be a bug.
Is it expected that secrets are not available inside a conditional step? I'm running the following and it gives me the result below. Notice that credentials were not passed (no *** printed)
Activity
louisgv commentedon Feb 2, 2021
The specific case described in the ticket can be done with plain shell script. Something like the example below:
More complex - well we shall wait for #646
igagis commentedon Feb 2, 2021
@louisgv Well, ok, actually, I want the
if:in composite actions to avoid running in shell which are not present in the system. So that I could make universal actions which would run in linux images, as well as windows ones (i.e. bash/powershell).So, implementing check in
bashis not an option for me sincebashcan be absent.dcharles-godaddy commentedon Jul 29, 2021
I'd like to have an action that does different things depending upon
cancelled(),failure(), orsuccess(), and these functions do not appear to be available inside of arun:tahirmt commentedon Aug 18, 2021
Is there any plan to add if conditionals to composite actions now that they support
usespotatoqualitee commentedon Aug 19, 2021
lol, didn't even realize i needed an if conditional as well. I'm basically building a wrapper for
actions/cache@v2which requiresif: steps.cacher.outputs.cache-hit != 'true'within my composite action. looking forward to this implementation!🚧 progress: Explicit shell for run steps.
Avoid using YAML-level `if` clauses for now
Avoid using YAML-level `if` clauses for now
smokedlinq commentedon Aug 25, 2021
Also have a need for this. It's the last thing keeping me from using composites similar to Azure DevOps pipeline templates...
sondrelg commentedon Aug 27, 2021
I came here looking for an answer to this - and with some inspiration from @louisgv I think I might have been able to come up with a temporary workaround until
ifs are fully supported. Posting it here just in case anyone finds it useful:Instead of this:
It looks like this would also work
Here is a full example workflow. Here is an example of a project using the remote workflow with a cold cache, and here with a warm cache 👍
It seems to work the same at least 🤞
potatoqualitee commentedon Aug 27, 2021
super cool interim solution, thanks for sharing, @sondrelg !
sebastianluszczek commentedon Aug 27, 2021
@sondrelg would like to use your result but have a little different problem
I got some input (not required)
but it always get into first block even if I not specify test while using action
sondrelg commentedon Aug 27, 2021
I had some trouble with missing values as well @sebastianluszczek - perhaps it would help to set a default value for your input, and check against that, rather than using
-z?GHA: Add IRC notifications action
50 remaining items
Migrate if to full workflow & refactor action outputs
electriquo commentedon Nov 25, 2021
why do one need to find this thread and not read it in the original documentation?! :(
solarmosaic-kflorence commentedon Nov 29, 2021
@foolioo it is being tracked here now github/docs#12378
Move the testthat output and result uploading into the check-r-packag…
use "if:" for OS-specific additional setup steps
use "if:" for OS-specific additional setup steps
AlexDCraig commentedon Dec 10, 2021
Does the if conditional not work for outputs of previous steps?
For example:
This doesn't appear to actually run a conditional statement against the previous step's output and thus always runs.
solarmosaic-kflorence commentedon Dec 10, 2021
@AlexDHoffer it does work, although I have also had problems with matching on boolean
true. I have solved it by ensuring that the output is always cast as a string (e.g."true"), and then matching instead on the string value, likesteps.tag_check.outputs.tag_exists != 'true'. I feel like this might be a bug.EDIT: I think it's this one #1483
ccolella-mdc commentedon Feb 7, 2022
yes. This should also work.
actions/runner#834 is closed.
actions/runner#834 is closed.
actions/runner#834 is closed.
actions/runner#834 is closed.
albert-k-nylas commentedon May 4, 2022
Is it expected that secrets are not available inside a conditional step? I'm running the following and it gives me the result below. Notice that credentials were not passed (no *** printed)
