问题
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?
回答1:
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"
来源:https://stackoverflow.com/questions/34946194/how-to-perform-status-checks-in-github-repository