Debugging Github Actions on Hosted Runners

If you have worked with CI/CD tools like Azure Pipelines or GitHub Actions, I am sure you must have encountered situations where “it works on your machine, but not on the hosted runner/agent”.