Stuck at certain command when using macos-latest

I’m unable to proceed with my workflow, since I stuck at a certain command as shown below

  - name: Install SDK manager dependencies 
      run: |
          yes | sudo sdkmanager --sdk_root=$ANDROID_HOME --licenses
          yes | sudo sdkmanager --sdk_root=$ANDROID_HOME --verbose --no_https ${{env.ANDROID_SDK_PACKAGES}}

seems that command is not accepting the license by sending yes, however, the same command is working fine when I use it locally on my mac