How to only run Github Action if 3rd party checks pass?

Hi, is there a way to have an action workflow check that a CI has run / passed on a given PR before it runs? For instance:

I would like the Auto-Merge Bot / EIP Auto-Merge Bot (pull_request) to only run if it knows that the continuous-integration/travis-ci/pr and continuous-integration/travis-ci/push have passed. But this is also for if the action were triggered again. In other words if some other event were to occur that would re-run Auto-Merge Bot / EIP Auto-Merge Bot (pull_request) and at that point the continuous-integration/travis-ci/pr and continuous-integration/travis-ci/push had both passed, then I’d like for it to run again and fail otherwise.

Is there any way to do this? Or is it only possible if I converted the travis-ci to a github action / had it in a github workflow?

Here’s what worked for me:

https://api.github.com/repos/ethereum/EIPs/commits/<ref>/statuses for some reason only sees the statuses of my 3rd party CI checks. So even if other tests fail it only considers the CI ones.

So I used this property to check it every 30 seconds and then abort if an error occurs; here’s the code for that:

// HACK (alita): check the CI status and only continue if the CI is successful
const checkCIStatus = async () => {
  const Github = getOctokit(GITHUB_TOKEN);
  const pr = await requirePr()
  const status = await Github.repos.getCombinedStatusForRef({
    owner: context.repo.owner,
    repo: context.repo.repo,
    ref: pr.head.ref
  }).then(res => res.data.state)

  console.log(`status is '${status}'...`)
  if (status === "failure") {
    setFailed("CI checks failed; bot can only merge if CI checks pass")
    throw "CI checks failed; bot can only merge if CI checks pass"
  }

  return status === "success";
}

export const pauseInterval = (checker, next, timeout) => async () => {
  const status = await checker();
  if (!status) {
    setTimeout(pauseInterval(checker, next, timeout), timeout);
  } else {
    return next()
  }
}

// only runs the bot if the CI statuses pass; checks every 30 seconds
export const main = pauseInterval(checkCIStatus, _main, CHECK_STATUS_INTERVAL)

output from success

status is 'pending'...
status is 'pending'...
status is 'pending'...
status is 'pending'...
status is 'pending'...
status is 'pending'...
status is 'pending'...
status is 'pending'...
status is 'pending'...
status is 'pending'...
status is 'pending'...
status is 'success'...
<normal action outputs>

output from failed checks

status is 'pending'...
status is 'pending'...
(node:1603) UnhandledPromiseRejectionWarning: CI checks failed; bot can only merge if CI checks pass
status is 'failure'...
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1603) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1603) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This is notably only really possible in a custom action, but you could probably create a simple action / js file that could do the same behavior and be treated as an action before the given action. If you had that, and this failed / succeeded on success or error then you could conditionally call your action within the Github yaml script.