Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If condition not working in my git workflow

I have the following GitHub worflow code:

- name: Check if the project is central
  id: projectcheck
  run: echo "::set-output name=central::${{ contains(github.event.inputs.project, 'central') }}"
      
- name: output
   run: echo ${{ steps.projectcheck.outputs.central }}     
   ---  here I am getting true/false correctly based on the input project but the below if conditions are not working              
      
- name: if central
  if: ${{ steps.projectcheck.outputs.central }}  == "true"
  run: echo "central"
      
- name: if not central
  if: ${{ steps.projectcheck.outputs.central }} == "false"
  run: echo "central"

How can I make the if expression work?

like image 292
harshita N Avatar asked Nov 04 '25 10:11

harshita N


1 Answers

Try for testing

if: steps.projectcheck.outputs.central  == 'true'

Ìf steps.projectcheck.outputs.central is a string literal, you should not need ${{ }}

like image 152
VonC Avatar answered Nov 07 '25 10:11

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!