A GitHub Action that allows you to wait for another GitHub check to complete. This is useful if you want to run one Workflow after another one finishes.
steps:
- name: Wait for build to succeed
uses: fountainhead/action-wait-for-check@v1.0.0
id: wait-for-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: build
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Do something with a passing build
if: steps.wait-for-build.outputs.conclusion == 'success'
- name: Do something with a failing build
if: steps.wait-for-build.outputs.conclusion == 'failure'
- name: Do something when this check was never started
if; steps.wait-for-build.outputs.conclusion == 'creation_timed_out'This Action accepts the following configuration parameters via with:
-
tokenRequired
The GitHub token to use for making API requests. Typically, this would be set to
${{ secrets.GITHUB_TOKEN }}. -
checkNameRequired
The name of the GitHub check to wait for. For example,
buildordeploy. -
refDefault:
github.shaThe Git ref of the commit you want to poll for a passing check.
PROTIP: You may want to use
github.pull_request.head.shawhen working with Pull Requests. -
repoDefault:
github.repo.repoThe name of the Repository you want to poll for a passing check.
-
ownerDefault:
github.repo.ownerThe name of the Repository's owner you want to poll for a passing check.
-
creationTimeoutSecondsDefault:
60The number of seconds to wait for the check to be created. If the check isn't created within this time, this action will emit a
conclusionvalue ofcreation_timed_out. -
timeoutSecondsDefault:
600The number of seconds to wait for the check to complete. If the check does not complete within this amount of time, this Action will emit a
conclusionvalue oftimed_out. -
intervalSecondsDefault:
10The number of seconds to wait before each poll of the GitHub API for checks on this commit.
This Action emits a single output named conclusion. Like the field of the same name in the CheckRunEvent API Response, it may be one of the following values:
successfailureneutraltimed_outcreation_timed_outaction_required
These correspond to the conclusion state of the Check you're waiting on. In addition, this action will emit a conclusion of timed_out if the Check specified didn't complete within timeoutSeconds. creation_timed_out is returned when the
check wasn't created in the creationTimeoutSeconds time (Eg optional checks based on what folders were changed in a monorepo).