Run workflow after other checks passed in PR

Trying to find JS solution for such activity:

  • on PR opened or changed
  • workflow to wait until all other checks passed
  • if passed -> then run and set it’s status to passed
  • otherwise set failed status

Found a similar request here How to trigger workflow when all checks pass for pull request (combined status) but it has link to outdated API and available solutions either don’t work either not in JS.

Happy to combine that action myself, but not sure on which trigger I should rely, as check_run or check_suite note says: ‘…run only on default branch’ which seems not a case for PRs.

Thank you in advance.

Found https://github.com/marketplace/actions/wait-for-check which works and with additional hacks seem to do what needed.