Well, here is how this was finally fixed. Using await was one step closer to the solution.
However, it was cypress-promise that helped in fixing the issue. Click here to read more about cypress-promise. Now the code looks like this:
const sleepTimeMs = 500;
console.log(chalk.yellow('Checking API health before test execution...'));
You can use
I did a small change on the .yml file. Before it was selected 'Master' branch to push new commit to, but what I have is 'Main' branch. I also added the line workflow_dispatch: to manually running the workflow. Now the workflow is running.