Use different input parameter based on a condition #26557
-
I am trying to run deploy action for my staging and production, and I’d like to use different SSH keys which are added as GH secret, based on which branch I’m on. So I added a ‘stage check’ step before my other steps in the deployment process that looks like this
In my other steps, I can now get access to
and
I now have
But this seems to fail. Not 100% sure why, but my hunch is that the output cannot see the encrypted secret content, so when it’s being used in the parameter So what I’m wondering if it’s possible to do, in one step, to have something like
So that my input argument to the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I see two issues here:
|
Beta Was this translation helpful? Give feedback.
-
Yeah, I got the production stage all the time. I’ve fixed this, but the key one was tricky, so I separated this to 4 steps, all of them have the Thanks for the help! |
Beta Was this translation helpful? Give feedback.
I see two issues here:
current_stage
step are mixing Bash and GitHub Actions syntax, and the result of that is probably not what you want (both are always true, so you always get the production path because it’s checked first). You should use Actions syntax (the${{ ... }}
part) only to substitute thegithub.ref
and Bash for the rest: