How to perform status checks in github repository

Fr_nkenstien picture Fr_nkenstien · Jan 22, 2016 · Viewed 12.7k times · Source

I have a GitHub repository in which I protected one branch with the new feature of Protected Branches.

Now my problem is that I wish to perform the status check in the system and then commit and push it to the GitHub repo.

Problem: where do I perform such status checks and how do I send the message to the GitHub server that the status checks have been cleared?

Answer

VonC picture VonC · Jan 22, 2016

where do I perform such status checks

In the same place you set up status checks: settings/branches (select your branch)

and how do I send the message to the GitHub server that the status checks have been cleared

Those checks are updated when you push from your local repo to that branch.


In order to send a success status, you can follow Building a CI server: it will use the Status API.
The Status API is responsible for tying together commits with a testing service, so that every push you make can be tested and represented in a GitHub pull request.

def process_pull_request(pull_request)
  @client.create_status(pull_request['base']['repo']['full_name'], pull_request['head']['sha'], 'pending')
  sleep 2 # do busy work...
  @client.create_status(pull_request['base']['repo']['full_name'], pull_request['head']['sha'], 'success')
  puts "Pull request processed!"
end

We're doing three very basic things here:

  • we're looking up the full name of the repository
  • we're looking up the last SHA of the pull request
  • we're setting the status to "success"