Skip to content

✅ Await the completion of a foreign repository Workflow Run given the Run ID.

License

Notifications You must be signed in to change notification settings

Codex-/await-remote-run

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

GitHub Action: await-remote-run

GitHub Workflow Status code style: prettier codecov GitHub Marketplace

Await the completion of a foreign repository Workflow Run given the Run ID.

This Action exists as a workaround for the issue where you cannot await the completion of a dispatched action.

This action requires being able to get the run ID from a dispatched action, this can be achieved through another Action i've created, return-dispatch.

Should a remote workflow run fail, this action will attempt to output which step failed, with a link to the workflow run itself.

An example using both of these actions is documented below.

Usage

Once you have configured your remote repository to work as expected with the return-dispatch action, include await-remote-run as described below.

steps:
  - name: Dispatch an action and get the run ID
    uses: codex-/return-dispatch@v1
    id: return_dispatch
    with:
      token: ${{ github.token }}
      repo: repository-name
      owner: repository-owner
      workflow: automation-test.yml
  - name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }}
    uses: Codex-/await-remote-run@v1.0.0
    with:
      token: ${{ github.token }}
      repo: return-dispatch
      owner: codex-
      run_id: ${{ steps.return_dispatch.outputs.run_id }}
      run_timeout_seconds: 300 # Optional
      poll_interval_ms: 5000 # Optional

Permissions Required

The permissions required for this action to function correctly are:

  • repo scope
    • You may get away with simply having repo:public_repo
    • repo is definitely needed if the repository is private.
  • actions:read

APIs Used

For the sake of transparency please note that this action uses the following API calls:

For more information please see api.ts.

Where does this help?

If you want to use the result of a Workflow Run from a remote repository to complete a check locally, i.e. you have automated tests on another repository and don't want the local checks to pass if the remote fails.