I am trying to run a conditional check before running the run
command.
And the docker runs on ubuntu.
runs-on: ubuntu-latest
- name: 'Running checks with test'
if: ${{grep -c 'ApexClass' package/package.xml > 0}}
run: |
echo "Found ApexClass"
- name: 'Running checks without test'
if: ${{grep -c 'ApexClass' package/package.xml < 0}}
run: |
echo "No Apex Found"
And throws an error :
The workflow is not valid. .github/workflows/preDeployCheckQA.yml (Line: 32, Col: 13): Unrecognized named-value: 'grep'. Located at position 1 within expression: grep -c 'ApexClass' package/package.xml > 0 .github/workflows/preDeployCheckQA.yml (Line: 36, Col: 13): Unrecognized named-value: 'grep'. Located at position 1 within expression: grep -c 'ApexClass' package/package.xml < 0
How do I add a check like grep
CodePudding user response:
If this is not supported, I would try and:
- define a variable
apexcl=$(grep -c 'ApexClass' package/package.xml)
- use if in the
if
conditional
That is:
if: ${{ apexcl != '' }}
run...
if: ${{ apexcl == '' }}
run...