GitHub – Delete Pull Request Status Checks

github

I've been looking for a means of removing some status checks created by a CI tool I was evaluating from my pull requests in my GitHub repository, but I haven't had any luck finding a way of achieving this.

Looking at the status checks API docs, there doesn't seem to be DELETE endpoint for the Statuses API and I could not find anything obvious in the UI.

Best Answer

The best solution I've been able to come up with is to create a new status on the same context as successful. This way I can remove the build URL from the status checks and the PRs don't show up as failing (as they were in my case).

To do this I iterated through all the most recent SHAs of my Pull Requests and made the following API call using curl:

curl --user "username" --data @- https://api.github.com/repos/:owner/:repo/commits/:sha
{
  "state": "success",
  "description": "The build succeeded!",
  "context": "default"
}

It doesn't completely erase the build history (so it can still be found using the API), but on the pull request pages everything looks like business as usual.