Run tests when deployment of "Pull request" finishes


In my environment, all Pull Requests are deployed automatically as Heroku Review Apps. What I’d like to do is to run tests from GitHub Actions when the deployment finishes and have those tests as a “status check” in GitHub so that PRs cannot be merged if the tests fail.

I thought I’d be able to use “deployment_status” (as that’s triggered by Review Apps) as the workflow trigger for a GitHub Action that would test the deployed app. However, when I use “deployment_status” , the action is correctly triggered and the tests run but that run is not associated as a Check in my open PR, so I can’t see the results from the PR and much less block merge depending on the result of the tests.

Is there any way to achieve what I want to do? It seems to be quite a normal requirement and the deployment is correctly linked to the PR on GitHub, so hopefully I am just missing something and it is not difficult to implement.


The jobs only from the following workflow runs can be listed as the checks on a Pull Request:

  1. Workflow runs triggered by the events that are related to Pull Request.

  2. Workflow runs triggered by the push event on the head branch (source branch) of the Pull Request.

The deployment and deployment_status are not the events that related to Pull Request.

Thanks a lot for the response. Is that list in any document? To keep track of it in case it changes.

Do you think this could be somehow changed? I have added the workflow in a branch and “deployment_status” is only triggered for deployments related to that branch, so it seems the information is actually available. Also, the “deployment” information appears in the pull request but it doesn’t seem I can set a workflow triggered by the addition of that information to the PR; can I? Is there any official way to request features? :slight_smile:

Meanwhile, I would be most thankful if you had any curated example of how to achieve this with other means or could provide advice. I thought of creating a pending status in a PR and then updating it in the deployment_status, but there’s quite a few things to do to make that “production-ready”


You can share your feature requests in the Feedback form for GitHub. That will allow you to directly interact with the appropriate engineering team, and make it more convenient for the engineering team to collect and categorize your suggestions.

I am having the same question: how to relate a deployment to a PR.

See also

Is there any update or related feature request available?

I am also trying to figure out the same thing. So far, no luck.