YML Command throws error on FE app but works on BE app

So after search the internet I found a script that checks for the main branch if there are commits in the last 24 hours in order to trigger a CICD.

This is the script I use

check_date:
    runs-on: ubuntu-latest
    name: Check latest commit
    outputs:
      should_run: ${{ steps.should_run.outputs.should_run }}
    steps:
      - uses: actions/checkout@v2
      - name: print latest_commit
        run: echo ${{ github.sha }}

      - id: should_run
        continue-on-error: true
        name: check latest commit is less than a day
        if: ${{ github.event_name == 'schedule' }}
        run: test -z $(git rev-list  --after="24 hours"  ${{ github.sha }}) && echo "::set-output name=should_run::false"

This works ok on by BE application, but when I added to my FE application it throws an error
" Invalid workflow file

You have an error in your yaml syntax on line 30"

Line 30 is line with run: test -z …

I am kind of new to the YML and would like some input or where to search for a solution for my problem.

Thank you