Need help with env GitHub Action and check conditions #26000
-
Release APK
I just started messing around with GitHub Action and I am feeling stuck. I have been trying to achieve something like if(artifact exists) send Success email, else send Failure email but failed. Does GitHub Action have if else statement at all? Can anyone look at my latest script and guide me how to check if an artifact exists and send success email, send failure email otherwise. Thanks in advanced. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
calvertwong:
First of, there are syntax issues here. The
Secondly, I don’t see those environment variables getting set anywhere in the excerpt you posted. If they aren’t set in a way that isn’t obvious in the workflow you’ll have to do that. Depending on how you set them you might also want to use boolean literals (e.g. Finally, there’s a small note in the documentation that |
Beta Was this translation helpful? Give feedback.
-
Let me add something in addition.
Secondly, env context only include environment variables which is set in Job level env or set env command. For |
Beta Was this translation helpful? Give feedback.
-
Thank you. I realized that the
|
Beta Was this translation helpful? Give feedback.
Let me add something in addition.
Firstly, when you use expressions in an
if
conditional, you may omit the expression syntax (${{ }}
) because GitHub automatically evaluates theif
conditional as an expression.You could use :
Secondly, env context only include environment variables which is set in Job level env or set env command. For
DEBUG_BUILD_SUCCESS
andRELEASE_BUILD_SUCCESS
, you need to set it to environment variable before you use it in if conditional.I am not sure how you confirm whether artifact exist or not. I you want to execute the send email steps based on the build step failed or succeeded, you…